From patchwork Wed Sep 20 22:45:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9962829 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 8F11260208 for ; Wed, 20 Sep 2017 22:49:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 813D328925 for ; Wed, 20 Sep 2017 22:49:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 761EA290DB; Wed, 20 Sep 2017 22:49:12 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 5AEF628925 for ; Wed, 20 Sep 2017 22:49:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751957AbdITWsw (ORCPT ); Wed, 20 Sep 2017 18:48:52 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34823 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751704AbdITWrH (ORCPT ); Wed, 20 Sep 2017 18:47:07 -0400 Received: by mail-pg0-f68.google.com with SMTP id j16so2375922pga.2; Wed, 20 Sep 2017 15:47:07 -0700 (PDT) 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=Eugr3w2Ue39itRwqPhnN7tORfrUO8Jg50TZkVMAoucA=; b=Jt7lgJYRdfoQVUwHsIrnBAk1zHBx1Oixw9mfHm0wV4cTbM+oLauCjRSiRMZHpe4010 IsQCHRVFUUjoV44kZBidas711VxLTv7+lkzS9GzpoF9QDpjobVaWb/BYrFLiyc7kRtrR AxcTleQTw0TnHZZ9x4aCvDw7ctBgKaulE7HblpxHWBq9KdhMYTdIWA+5v99fWJGSBmsi jrn0I8Ft094YLxjqxL0qiO5Cwew0FhzFKVqvYUFjkgawwI2Ri6fVqevhOhKPMRYVhXN2 Wyk+oUvl9kmUGcNyiOoEd1Fei0aotG19IkeJuO9/rS29Zzs+Mc6aYrUMV3fKsuOtAmIJ ed8g== 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=Eugr3w2Ue39itRwqPhnN7tORfrUO8Jg50TZkVMAoucA=; b=K1xlHOsaUNue+ALdDH7nzJCXY0cqimbgQLVeLgBsH8a8bXguk1tVlB9t6MV05xi0OZ I29K8trF7vq8kxPnZ3QGaOAe4dj6GTRbFH3N1dYdTaK7o9j4aTvo/MykwQjOcnwSlfTY J6uEM5exSKPqFaL/B8gmdOrcYBFlhIJTPH2SqUDwvJVR4rBinyhfb4NxL6/IGVrXpTgn y9MOIqBKWVp5z5vP+q2bs+Wjo/XtmMp6GGf6EGo+c8wUgKeNKUOZQWTQABizKW4cUlY3 yFoyUvWubWMsUCwa4D6O63Y7PVK0Z1g4oiM6zVNmNfQiMIE4tEpjXdrZjNyHGZAoEO89 P8cA== X-Gm-Message-State: AHPjjUiRvbTd26JLVqWTkrMo0rq1DU7c6mGH9AZ35txI/WOzkjXI0Mf4 i+Az5Pjo6k8CQIu+0qkhsEIzUN0YlSE= X-Google-Smtp-Source: AOwi7QBejmwIUWTKqNhi9ll+OhOT+ZB/L/J7p7jbwjOOBo+dV4a8MrlObcOTdF1x7Zlcdicmz3ROMg== X-Received: by 10.84.132.34 with SMTP id 31mr3483910ple.225.1505947626710; Wed, 20 Sep 2017 15:47:06 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81]) by smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.47.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 20 Sep 2017 15:47:06 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Michael Halcrow , Eric Biggers Subject: [PATCH 14/25] ext4: switch to fscrypt_prepare_lookup() Date: Wed, 20 Sep 2017 15:45:54 -0700 Message-Id: <20170920224605.22030-15-ebiggers3@gmail.com> X-Mailer: git-send-email 2.14.1.821.g8fa685d3b7-goog In-Reply-To: <20170920224605.22030-1-ebiggers3@gmail.com> References: <20170920224605.22030-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/ext4/namei.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index b2fbc2b87bcf..a6b6f09e0a88 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1538,24 +1538,14 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi struct inode *inode; struct ext4_dir_entry_2 *de; struct buffer_head *bh; + int err; - if (ext4_encrypted_inode(dir)) { - int res = fscrypt_get_encryption_info(dir); - - /* - * DCACHE_ENCRYPTED_WITH_KEY is set if the dentry is - * created while the directory was encrypted and we - * have access to the key. - */ - if (fscrypt_has_encryption_key(dir)) - fscrypt_set_encrypted_dentry(dentry); - fscrypt_set_d_op(dentry); - if (res && res != -ENOKEY) - return ERR_PTR(res); - } + err = fscrypt_prepare_lookup(dir, dentry, flags); + if (err) + return ERR_PTR(err); - if (dentry->d_name.len > EXT4_NAME_LEN) - return ERR_PTR(-ENAMETOOLONG); + if (dentry->d_name.len > EXT4_NAME_LEN) + return ERR_PTR(-ENAMETOOLONG); bh = ext4_find_entry(dir, &dentry->d_name, &de, NULL); if (IS_ERR(bh))