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: 816595 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="koAhdB6C"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=infradead.org header.i=@infradead.org header.b="jg4rImFA"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Jt7lgJYR"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xyFw20tGdz9sNr for ; Thu, 21 Sep 2017 09:15:30 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4geIZ7dnWzXcNbh91iEqmV4kRhUOv4uk/ENxsT+Y3Dw=; b=koAhdB6CkD7lmjqrzK/ncrIUlf VilA+N/eF0wSkCBQGES3a/+AaZwdNEUJ1sOvDj3ryMtMp61YMyaTSSK4sIAJ5wi6dx9+HDmno0nGn CN9tXKUyh/NgT26LMP9y5q2m2ro7aq8XVfleb5PBo165rcNHadJWhM1P30MU5NPS73sjuhH66TPA9 jcDWyPjRIAV7eWTevab6dqA7fHh4v+op1tJxVxtsqR1XF+YsqwTlQShfhZ9eb5LXgZtYIPFwqXbAb xPMV6iFvwJ9Ba0S6i5gGT1S3ItFL50kjsJ1N44JyXJvWz3l+s3R5XYwv0/2IjEYt7a3pa5HfgJPC5 4BPwf0NA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1duoD9-0001g7-EJ; Wed, 20 Sep 2017 23:15:19 +0000 Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1duoAq-0006j8-1o for linux-mtd@bombadil.infradead.org; Wed, 20 Sep 2017 23:12:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Eugr3w2Ue39itRwqPhnN7tORfrUO8Jg50TZkVMAoucA=; b=jg4rImFAFbJjgan8KCYDXJ6Kt WKBany7YKVPKoN5F/C1KBppAmSfZWLEO3EUgaQBoH78lE1yQuebY00gjkzHxqh440LbbvaLb2ig32 npLHNGPL9BcEPNmz8PQ+xwNGsJ4Evyyiq89WE+KhocJ8iGiT/f/X82CBdlnqRgGNfilaVm9NlcA8I cCMoVJMSFhoj7EVsO8BIf/aw1+BC8Yl/IoQHnbeycEkdVOerHy2uRD8Y7l2IR2OU7ZBsgd1nVLe5n /naywPP2S7vBB2rNOeM5bYEKo2LpXm8Vu34q/ZK6fYD12IM5xX/1snNExKVX7+YrdChRBCXlhxleq v/VrK2zzw==; Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dunmA-0004sn-61 for linux-mtd@lists.infradead.org; Wed, 20 Sep 2017 22:47:29 +0000 Received: by mail-pg0-x243.google.com with SMTP id j16so2375917pga.2 for ; Wed, 20 Sep 2017 15:47:08 -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=Nudez84ytC0gc27IDBU52MS/EnQWSY20xowiLsPuk247GpHLuChKcHZLZ0ymiN//JU +36ZWjfMxkcqg+3F9oVXDilFP5c2dmiYurCsivrw+14toeKJOOEIK3UOPocUR7IY+sPq Y/k9ZH9QUUZqLx8qK28PsqwoFDAwHqfdt3O4JyHeLUsPzdz7C/1JbWXHuzmCyYIYnkpM 6KBNFHbwfzYB8DsbQz5MQF1gWdCTqzmfKY/Cee9SHmatYdNm+5u5Evm57T85dKzePrcg ag1JmZkgQYbs5QzXwyDdMZTS+79ngOFrSjrDau8g2DpALtHYnCw0ZHF/pDJYTMAx/2Sp Hk/w== X-Gm-Message-State: AHPjjUgpzkFlPwkxi82M60ulrHBteIaUXEv1MY0S8WL8cyPmhn9f4hRA +GDnv5htBoyZd4SsYCpyMd4= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170920_234726_375332_4467E2AF X-CRM114-Status: GOOD ( 14.48 ) X-Spam-Score: -1.8 (-) X-Spam-Report: SpamAssassin version 3.4.1 on casper.infradead.org summary: Content analysis details: (-1.8 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (ebiggers3[at]gmail.com) 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (ebiggers3[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Theodore Y . Ts'o" , Eric Biggers , Michael Halcrow , linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org, Jaegeuk Kim , linux-ext4@vger.kernel.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org 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))