{"id":816617,"url":"http://patchwork.ozlabs.org/api/patches/816617/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-14-ebiggers3@gmail.com/","project":{"id":3,"url":"http://patchwork.ozlabs.org/api/projects/3/?format=json","name":"Linux MTD development","link_name":"linux-mtd","list_id":"linux-mtd.lists.infradead.org","list_email":"linux-mtd@lists.infradead.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920224605.22030-14-ebiggers3@gmail.com>","list_archive_url":null,"date":"2017-09-20T22:45:53","name":"[13/25] ext4: switch to fscrypt_prepare_rename()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"5991de039eb509f8f05b76ee4346ad70d8016cc6","submitter":{"id":65202,"url":"http://patchwork.ozlabs.org/api/people/65202/?format=json","name":"Eric Biggers","email":"ebiggers3@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-mtd/patch/20170920224605.22030-14-ebiggers3@gmail.com/mbox/","series":[{"id":4250,"url":"http://patchwork.ozlabs.org/api/series/4250/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-mtd/list/?series=4250","date":"2017-09-20T22:45:45","name":"fscrypt: add some higher-level helper functions","version":1,"mbox":"http://patchwork.ozlabs.org/series/4250/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816617/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816617/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org; spf=none (mailfrom)\n\tsmtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133;\n\thelo=bombadil.infradead.org;\n\tenvelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=lists.infradead.org\n\theader.i=@lists.infradead.org header.b=\"ex8SPY/c\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=infradead.org header.i=@infradead.org\n\theader.b=\"apy5jgxF\"; \n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"i0GLmEHH\"; dkim-atps=neutral"],"Received":["from bombadil.infradead.org (bombadil.infradead.org\n\t[65.50.211.133])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xyGjR5WP2z9s7h\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 21 Sep 2017 09:51:23 +1000 (AEST)","from localhost ([127.0.0.1] helo=bombadil.infradead.org)\n\tby bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux))\n\tid 1duols-0003TZ-5G; Wed, 20 Sep 2017 23:51:12 +0000","from merlin.infradead.org ([2001:8b0:10b:1231::1])\n\tby bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1duok4-0001Bu-T1\n\tfor linux-mtd@bombadil.infradead.org; Wed, 20 Sep 2017 23:49:21 +0000","from mail-pg0-x244.google.com ([2607:f8b0:400e:c05::244])\n\tby merlin.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux))\n\tid 1dunmC-00017U-QU\n\tfor linux-mtd@lists.infradead.org; Wed, 20 Sep 2017 22:47:29 +0000","by mail-pg0-x244.google.com with SMTP id i130so2381469pgc.0\n\tfor <linux-mtd@lists.infradead.org>;\n\tWed, 20 Sep 2017 15:47:07 -0700 (PDT)","from ebiggers-linuxstation.kir.corp.google.com ([100.66.174.81])\n\tby smtp.gmail.com with ESMTPSA id j2sm6249pgn.26.2017.09.20.15.47.04\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Sep 2017 15:47:05 -0700 (PDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=lists.infradead.org; s=bombadil.20170209; h=Sender:\n\tContent-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe:\n\tList-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References:\n\tIn-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID:\n\tContent-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc\n\t:Resent-Message-ID:List-Owner;\n\tbh=aGVi0rTlLGT477BX9LNO575++vdY8gcbEvie0WB9gyo=;\n\tb=ex8SPY/cH/JE+p/fCA541obI3J\n\tWnK7HlblzIchqXFeBPL4FyCDpyc/LaV2k9q+/pdOSimsDNLS6g0nALr9Yk03M+AuIrSy5SMfg7xTe\n\tB+wrMUtCYHp/jKXssZsmlyQnRwMgV+AT+/g9co8dWosKfUXnNC6UC0EJmiobRiQ2kgkT8A2CXx110\n\tC3aeetmQwjQmq3YajIUTok/PwWci1AzNktS+2Sbn9LgLeJNXw0V0YCIYGuuOFA2z4nDpdRen0ZMqG\n\tQAe7djaZRK4qVPgI0ykk7J1tTT4lFWT5zm1ypl4bjxmuxd48KJe7+SbT8bZUiQhkqeBBp91ti/yra\n\tD+o9YAtQ==;","v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n\td=infradead.org; s=merlin.20170209;\n\th=References:In-Reply-To:Message-Id:Date:\n\tSubject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type:\n\tContent-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:\n\tResent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:\n\tList-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive;\n\tbh=sM58lWxHc4E394SB2Muu1uxUp2WU4oewgYhWHZMbS9o=;\n\tb=apy5jgxFim6YWYbILf6awLeKe\n\tHUV/VG9em4Ss79p+dd0G48vnndfB9N0P5mHTtVZtXyjjRCmtwWtFmmWAwVZ+TkrTi8s7kzXIr7jVK\n\twtZpRciWzp/9cA8WvM3BkU3kULP0YFepygOHWnq0U4GdaHuNliAxi/U3A6gJw63XeJj+JkrUeCfCI\n\tIn/u18NrkfSzJ3CiuHQ9uDJzCRrz2sRUFWM7RSHrX+VmXRDH2d1KDH9o8wCyfhXOXpzw1TRwjG9z0\n\t0eeVO/N6jDb68O1nxtd8Qfx4FcOT7VRqNKeu6PFwvwJ32v0xiIgi1OkqnoXH+FwKZVM45Oc3MyQyB\n\t9GqwBRgLg==;","v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=sM58lWxHc4E394SB2Muu1uxUp2WU4oewgYhWHZMbS9o=;\n\tb=i0GLmEHHUqOLF8/hYgw1I9Lx1Xa6pZ3BJ9xw76nCuU3Wi3J+9HZpXlHE1Cgnhn/GTh\n\t1SJ/MyrGdkN6g8Jj8G1drhk1Da/QU5kX1AwPHiVLUIwezn0sUZhWkAlUTnrTFtkrbsax\n\tEsEbGjycZr9tkTVnT/P0/fvCi8XHyRzaZgD4/KgLXlJPab7LTSdQiUhdBeB4mul+ZVh7\n\tMXDe2mowsVbdSViijhHggwHgyyZN89bJ3rPZFbVoOP4oboPnojjORJRXRSdKyOhaNk3/\n\t2alsw4H3nZa9Etp+VG3ZUMM+HBQPQ37OodMnRwcwIcoaN5OQeG6uhImia8FiXrNY9eEa\n\t5Ilg=="],"X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=sM58lWxHc4E394SB2Muu1uxUp2WU4oewgYhWHZMbS9o=;\n\tb=renIIeW7S2TlRFS3RJbd3ElNp4WlZIn1WCZUkep4culwblHJa835eYnmQzPLFs6UC4\n\tN+s5s6XQwGb77/TvZfPYdqDVALX9TQyjG4rbkqsm+F4oU7mwLYLZbh3efUuNKQ8TiSNs\n\tsy26PiXd50Zm1nnwz7HFXPVVgXb5xlzFJdJ6ZBLTWZk/I8yDbzE5An/XMljN1kVsqG6/\n\tJ0DAClxqOwuGtAhP9Yhq8Kk95ckHocfU1AcpsyVig/0zpNPdVpFNesHb6VFSzi7zVZ13\n\thWicG+ngBkY7CCaDgiY5SXBC7SYFrbUbuUFDoos8CTzb6MEQ5hYGXlrQe8FtdZj0DMT8\n\t7/1w==","X-Gm-Message-State":"AHPjjUgCohmCSKwC9Q9tlnQkSDMYtBPfsi6A5bvQXTiRxJQF+yIwh/0p\n\t2/nBfDMRVzv7yMi+xZcNAlw=","X-Google-Smtp-Source":"AOwi7QBP6a6x8P7lbYDp/n2H5C8yfjymALkj4exutY4HP6wfeN1bSxg3GvqR2viIi+V6/h4RrOr80Q==","X-Received":"by 10.99.4.7 with SMTP id 7mr3538064pge.400.1505947625571;\n\tWed, 20 Sep 2017 15:47:05 -0700 (PDT)","From":"Eric Biggers <ebiggers3@gmail.com>","To":"linux-fscrypt@vger.kernel.org","Subject":"[PATCH 13/25] ext4: switch to fscrypt_prepare_rename()","Date":"Wed, 20 Sep 2017 15:45:53 -0700","Message-Id":"<20170920224605.22030-14-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-Spam-Note":"CRM114 invocation failed","X-Spam-Score":"-1.8 (-)","X-Spam-Report":"SpamAssassin version 3.4.1 on merlin.infradead.org summary:\n\tContent analysis details:   (-1.8 points)\n\tpts rule name              description\n\t---- ----------------------\n\t--------------------------------------------------\n\t-0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/,\n\tno\n\ttrust [2607:f8b0:400e:c05:0:0:0:244 listed in] [list.dnswl.org]\n\t0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends\n\tin digit (ebiggers3[at]gmail.com)\n\t-0.0 SPF_PASS               SPF: sender matches SPF record\n\t0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\n\tprovider (ebiggers3[at]gmail.com)\n\t-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%\n\t[score: 0.0000]\n\t0.1 DKIM_SIGNED            Message has a DKIM or DK signature,\n\tnot necessarily valid\n\t-0.1 DKIM_VALID Message has at least one valid DKIM or DK signature\n\t-0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from\n\tauthor's domain","X-BeenThere":"linux-mtd@lists.infradead.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"Linux MTD discussion mailing list <linux-mtd.lists.infradead.org>","List-Unsubscribe":"<http://lists.infradead.org/mailman/options/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=unsubscribe>","List-Archive":"<http://lists.infradead.org/pipermail/linux-mtd/>","List-Post":"<mailto:linux-mtd@lists.infradead.org>","List-Help":"<mailto:linux-mtd-request@lists.infradead.org?subject=help>","List-Subscribe":"<http://lists.infradead.org/mailman/listinfo/linux-mtd>,\n\t<mailto:linux-mtd-request@lists.infradead.org?subject=subscribe>","Cc":"\"Theodore Y . Ts'o\" <tytso@mit.edu>, Eric Biggers <ebiggers@google.com>, \n\tMichael Halcrow <mhalcrow@google.com>,\n\tlinux-f2fs-devel@lists.sourceforge.net, \n\tlinux-mtd@lists.infradead.org, linux-fsdevel@vger.kernel.org,\n\tJaegeuk Kim <jaegeuk@kernel.org>, linux-ext4@vger.kernel.org","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"\"linux-mtd\" <linux-mtd-bounces@lists.infradead.org>","Errors-To":"linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org"},"content":"From: Eric Biggers <ebiggers@google.com>\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\n---\n fs/ext4/namei.c | 33 +++++++--------------------------\n 1 file changed, 7 insertions(+), 26 deletions(-)","diff":"diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c\nindex b2058500f1dc..b2fbc2b87bcf 100644\n--- a/fs/ext4/namei.c\n+++ b/fs/ext4/namei.c\n@@ -3516,12 +3516,6 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,\n \t\t\tEXT4_I(old_dentry->d_inode)->i_projid)))\n \t\treturn -EXDEV;\n \n-\tif ((ext4_encrypted_inode(old_dir) &&\n-\t     !fscrypt_has_encryption_key(old_dir)) ||\n-\t    (ext4_encrypted_inode(new_dir) &&\n-\t     !fscrypt_has_encryption_key(new_dir)))\n-\t\treturn -ENOKEY;\n-\n \tretval = dquot_initialize(old.dir);\n \tif (retval)\n \t\treturn retval;\n@@ -3550,13 +3544,6 @@ static int ext4_rename(struct inode *old_dir, struct dentry *old_dentry,\n \tif (!old.bh || le32_to_cpu(old.de->inode) != old.inode->i_ino)\n \t\tgoto end_rename;\n \n-\tif ((old.dir != new.dir) &&\n-\t    ext4_encrypted_inode(new.dir) &&\n-\t    !fscrypt_has_permitted_context(new.dir, old.inode)) {\n-\t\tretval = -EPERM;\n-\t\tgoto end_rename;\n-\t}\n-\n \tnew.bh = ext4_find_entry(new.dir, &new.dentry->d_name,\n \t\t\t\t &new.de, &new.inlined);\n \tif (IS_ERR(new.bh)) {\n@@ -3722,19 +3709,6 @@ static int ext4_cross_rename(struct inode *old_dir, struct dentry *old_dentry,\n \tint retval;\n \tstruct timespec ctime;\n \n-\tif ((ext4_encrypted_inode(old_dir) &&\n-\t     !fscrypt_has_encryption_key(old_dir)) ||\n-\t    (ext4_encrypted_inode(new_dir) &&\n-\t     !fscrypt_has_encryption_key(new_dir)))\n-\t\treturn -ENOKEY;\n-\n-\tif ((ext4_encrypted_inode(old_dir) ||\n-\t     ext4_encrypted_inode(new_dir)) &&\n-\t    (old_dir != new_dir) &&\n-\t    (!fscrypt_has_permitted_context(new_dir, old.inode) ||\n-\t     !fscrypt_has_permitted_context(old_dir, new.inode)))\n-\t\treturn -EPERM;\n-\n \tif ((ext4_test_inode_flag(new_dir, EXT4_INODE_PROJINHERIT) &&\n \t     !projid_eq(EXT4_I(new_dir)->i_projid,\n \t\t\tEXT4_I(old_dentry->d_inode)->i_projid)) ||\n@@ -3861,12 +3835,19 @@ static int ext4_rename2(struct inode *old_dir, struct dentry *old_dentry,\n \t\t\tstruct inode *new_dir, struct dentry *new_dentry,\n \t\t\tunsigned int flags)\n {\n+\tint err;\n+\n \tif (unlikely(ext4_forced_shutdown(EXT4_SB(old_dir->i_sb))))\n \t\treturn -EIO;\n \n \tif (flags & ~(RENAME_NOREPLACE | RENAME_EXCHANGE | RENAME_WHITEOUT))\n \t\treturn -EINVAL;\n \n+\terr = fscrypt_prepare_rename(old_dir, old_dentry, new_dir, new_dentry,\n+\t\t\t\t     flags);\n+\tif (err)\n+\t\treturn err;\n+\n \tif (flags & RENAME_EXCHANGE) {\n \t\treturn ext4_cross_rename(old_dir, old_dentry,\n \t\t\t\t\t new_dir, new_dentry);\n","prefixes":["13/25"]}