From patchwork Fri Dec 15 17:42:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10115705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 55C1E6019C for ; Fri, 15 Dec 2017 17:47:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 43EF329EE1 for ; Fri, 15 Dec 2017 17:47:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 38D112A024; Fri, 15 Dec 2017 17:47:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D173229EE1 for ; Fri, 15 Dec 2017 17:47:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755977AbdLORrH (ORCPT ); Fri, 15 Dec 2017 12:47:07 -0500 Received: from mail-pg0-f68.google.com ([74.125.83.68]:46657 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755711AbdLORq6 (ORCPT ); Fri, 15 Dec 2017 12:46:58 -0500 Received: by mail-pg0-f68.google.com with SMTP id b11so6242146pgu.13; Fri, 15 Dec 2017 09:46:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QwmgdyEhQdLEe23GR7crp+rYN1qd48mZQnGA88cbj+o=; b=qbIGggAZb60uhwIuEWMlftMq6mtwb7vE996Q7v6B3m3AjiXu+fy7VJV9D65VnjWkZU mnph6j//I7RGeT3Z2Fhu9a3I7jjj3sLdFeewlcP+9DH+WvUlC43jFYXaCM4jBRrOws0X 84ISCf1z25B1Wpfynt/zCIiKQbwWrT8bGcfJBtiXPQJ/+cRyhQ1llVpSHczDfIhroy1n 1h8nwU3Bu9qJgtdiyOU7Kmpc+O+8atCMkJSJSALBnTF60fGvM+5wdRoKhOMrRWbnSbnY ZYJfN45DQ/GWwcUiah8EByM+zXefj0QypimMJ+CA62iWB53C/4AV6kWOifdO0vTJ5ZJ0 WbtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QwmgdyEhQdLEe23GR7crp+rYN1qd48mZQnGA88cbj+o=; b=FYr8V887xE2No151iRUX5PGEeC+NdFt+b8LgJtrL3ggv1cK7500N7eS1QNmhvU7TA9 4pxwowbpf2AxsZIMRc8nLHfYh1gytADyiJIULI7Tk91ujOB0NjDhV4Q+hsrzQqg3XGAr HVIWQPaNbYtY9iZZ0F1mnuAklnYQapM/7VbkoPLChJ9CxuEF9+hfaY62uXtzSKdcuXtE K2npeUBIx8ZX5jVyWKxLGjDOJyAJDrnoj4Ps9F57IsoZtTfezKeyIXQ9kHmZwZku4W+w WLKk72OnM2HW3JhTbB3daX9nJNDFiHH57XoB1mQ59hYnpVnDNqahKBW/L+3rwyuyQj8s 75kg== X-Gm-Message-State: AKGB3mLQvhnyzeyLOHpAKaZn5ZZRq8BUd8mHrlVxuu+1ak8yyeg8rxnI rishC5y3WVS06pFqLxfOiLv1KqC36zY= X-Google-Smtp-Source: ACJfBovueMyYjumt0MMy++2JCecGrrmiW5YcbZZY2ZAE1oWEewvPV8/X6EdmviKuWnjwC8jUt2N1hg== X-Received: by 10.84.232.6 with SMTP id h6mr13939964plk.263.1513360017965; Fri, 15 Dec 2017 09:46:57 -0800 (PST) Received: from zzz.localdomain (c-67-185-97-198.hsd1.wa.comcast.net. [67.185.97.198]) by smtp.gmail.com with ESMTPSA id j62sm12980149pfc.18.2017.12.15.09.46.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Dec 2017 09:46:57 -0800 (PST) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: "Theodore Y . Ts'o" , Jaegeuk Kim , linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Eric Biggers Subject: [PATCH 18/24] ubifs: switch to fscrypt_get_symlink() Date: Fri, 15 Dec 2017 09:42:19 -0800 Message-Id: <20171215174225.31583-19-ebiggers3@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171215174225.31583-1-ebiggers3@gmail.com> References: <20171215174225.31583-1-ebiggers3@gmail.com> Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eric Biggers Signed-off-by: Eric Biggers --- fs/ubifs/file.c | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/fs/ubifs/file.c b/fs/ubifs/file.c index dfe85069586e..3cfc578c42ea 100644 --- a/fs/ubifs/file.c +++ b/fs/ubifs/file.c @@ -1662,49 +1662,17 @@ static const char *ubifs_get_link(struct dentry *dentry, struct inode *inode, struct delayed_call *done) { - int err; - struct fscrypt_symlink_data *sd; struct ubifs_inode *ui = ubifs_inode(inode); - struct fscrypt_str cstr; - struct fscrypt_str pstr; - if (!ubifs_crypt_is_encrypted(inode)) + if (!IS_ENCRYPTED(inode)) return ui->data; if (!dentry) return ERR_PTR(-ECHILD); - err = fscrypt_get_encryption_info(inode); - if (err) - return ERR_PTR(err); - - sd = (struct fscrypt_symlink_data *)ui->data; - cstr.name = sd->encrypted_path; - cstr.len = le16_to_cpu(sd->len); - - if (cstr.len == 0) - return ERR_PTR(-ENOENT); - - if ((cstr.len + sizeof(struct fscrypt_symlink_data) - 1) > ui->data_len) - return ERR_PTR(-EIO); - - err = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); - if (err) - return ERR_PTR(err); - - err = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); - if (err) { - fscrypt_fname_free_buffer(&pstr); - return ERR_PTR(err); - } - - pstr.name[pstr.len] = '\0'; - - set_delayed_call(done, kfree_link, pstr.name); - return pstr.name; + return fscrypt_get_symlink(inode, ui->data, ui->data_len, done); } - const struct address_space_operations ubifs_file_address_operations = { .readpage = ubifs_readpage, .writepage = ubifs_writepage,