From patchwork Fri Apr 7 17:58:38 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 9670061 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 31C826021C for ; Fri, 7 Apr 2017 18:01:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 297992860E for ; Fri, 7 Apr 2017 18:01:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E59328628; Fri, 7 Apr 2017 18:01:04 +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 C12A628609 for ; Fri, 7 Apr 2017 18:01:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934658AbdDGSBD (ORCPT ); Fri, 7 Apr 2017 14:01:03 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35253 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934657AbdDGSBB (ORCPT ); Fri, 7 Apr 2017 14:01:01 -0400 Received: by mail-pg0-f68.google.com with SMTP id g2so16991568pge.2; Fri, 07 Apr 2017 11:01:01 -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=U/lfPYx9GYfMvuEWageN2yhFVzvqUwaSGut97JmC+vw=; b=te9uLkjtY+bSSgHTb3Pyt6x1oPG+OR4cixwkOJcA2p1/zw4EjCmlc1PrmoUqfU8AxP j7DL4WmpMQ6HSuMdY6XzE+y7FcbzElisRKR5Xy5fzWZzybEH2Us0snyyvg7dCEk1izI3 AZieD+nvu6kB4uvqTgmmRXunMLBL5u+bD6y0kbALnNlqEkFtIpG/LXxmLNhsnMJpD65p 6BaBZnx6uka3oPt4IbkLYrt0qp2h2AUfPaZlNDLag5SbwT2GH1pV1l49ZBzREWE/qRAz AUQ8OzaYnS1eEN3RNzVjjdeTWJn6naJsbOaEJ/QwopkHBbKlowckPP75T7jgZS0sKZOr jg/Q== 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=U/lfPYx9GYfMvuEWageN2yhFVzvqUwaSGut97JmC+vw=; b=kHzCDPj/8T/wAdeRdISrHmyLyxyD9EF6/+pJi9tvCYsB3YtxpU1ygrB/Sk+et+qloa 9wCnIcc22INuTBprZdHBG0Bg29iTnSwKh1/64HNuN2AaP6UbeI/z6EZZYw6SjCmbPkSp q7IKUvW21REqCj+6OgV6w3VMRiVvJRVLDpy1kABw8ZAAJ2lrp00lkFplIPGWF4FXtFtk p1mdppiEZjvum5gRmMDminw/j/UgAr5DRWHb7Pnl+1ajDfezmln/qbmVQ4RpkhamYE75 kHY72HCYtdIngh9beiDd7DciE6vIczeKjZMrIsW6R6CJMm6KAu2Pdbv+zfF1w0xQ7hdT EoYQ== X-Gm-Message-State: AFeK/H3c9q4F6KdiUqHRQYNuSV4fJ3vCMcdB2pmH1i+1zvsqzDcsmh+BlqoWsnGqjugg/g== X-Received: by 10.99.53.129 with SMTP id c123mr43752833pga.117.1491588060905; Fri, 07 Apr 2017 11:01:00 -0700 (PDT) Received: from ebiggers-linuxstation.kir.corp.google.com ([100.119.30.131]) by smtp.gmail.com with ESMTPSA id c64sm4747146pfa.110.2017.04.07.11.01.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 07 Apr 2017 11:01:00 -0700 (PDT) From: Eric Biggers To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, "Theodore Y . Ts'o" , Jaegeuk Kim , Richard Weinberger , Michael Halcrow , Eric Biggers Subject: [PATCH 2/4] ext4: remove "nokey" check from ext4_lookup() Date: Fri, 7 Apr 2017 10:58:38 -0700 Message-Id: <20170407175840.95740-3-ebiggers3@gmail.com> X-Mailer: git-send-email 2.12.2.715.g7642488e1d-goog In-Reply-To: <20170407175840.95740-1-ebiggers3@gmail.com> References: <20170407175840.95740-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 Now that fscrypt_has_permitted_context() correctly handles the case where we have the key for the parent directory but not the child, we don't need to try to work around this in ext4_lookup(). Signed-off-by: Eric Biggers --- fs/ext4/namei.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 6ad612c576fc..600b37874038 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1616,16 +1616,9 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, unsi if (!IS_ERR(inode) && ext4_encrypted_inode(dir) && (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) && !fscrypt_has_permitted_context(dir, inode)) { - int nokey = ext4_encrypted_inode(inode) && - !fscrypt_has_encryption_key(inode); - if (nokey) { - iput(inode); - return ERR_PTR(-ENOKEY); - } ext4_warning(inode->i_sb, "Inconsistent encryption contexts: %lu/%lu", - (unsigned long) dir->i_ino, - (unsigned long) inode->i_ino); + dir->i_ino, inode->i_ino); iput(inode); return ERR_PTR(-EPERM); }