{"id":816551,"url":"http://patchwork.ozlabs.org/api/patches/816551/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/patch/20170920224605.22030-24-ebiggers3@gmail.com/","project":{"id":8,"url":"http://patchwork.ozlabs.org/api/projects/8/?format=json","name":"Linux ext4 filesystem development","link_name":"linux-ext4","list_id":"linux-ext4.vger.kernel.org","list_email":"linux-ext4@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170920224605.22030-24-ebiggers3@gmail.com>","list_archive_url":null,"date":"2017-09-20T22:46:03","name":"[23/25] ubifs: switch to fscrypt_prepare_rename()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":true,"hash":"3cf9b97e570a7f2470ce317baabb669113737cc8","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-ext4/patch/20170920224605.22030-24-ebiggers3@gmail.com/mbox/","series":[{"id":4249,"url":"http://patchwork.ozlabs.org/api/series/4249/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-ext4/list/?series=4249","date":"2017-09-20T22:45:40","name":"fscrypt: add some higher-level helper functions","version":1,"mbox":"http://patchwork.ozlabs.org/series/4249/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/816551/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/816551/checks/","tags":{},"related":[],"headers":{"Return-Path":"<linux-ext4-owner@vger.kernel.org>","X-Original-To":"patchwork-incoming@ozlabs.org","Delivered-To":"patchwork-incoming@ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-ext4-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Gw51A00T\"; dkim-atps=neutral"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xyFHl2JRZz9sPk\n\tfor <patchwork-incoming@ozlabs.org>;\n\tThu, 21 Sep 2017 08:47:31 +1000 (AEST)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752084AbdITWra (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 20 Sep 2017 18:47:30 -0400","from mail-pf0-f195.google.com ([209.85.192.195]:33246 \"EHLO\n\tmail-pf0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1752025AbdITWrR (ORCPT\n\t<rfc822; linux-ext4@vger.kernel.org>); Wed, 20 Sep 2017 18:47:17 -0400","by mail-pf0-f195.google.com with SMTP id h4so1728716pfk.0;\n\tWed, 20 Sep 2017 15:47:16 -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.15\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tWed, 20 Sep 2017 15:47:15 -0700 (PDT)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=3FtVWARjoE+b9wG70tcBL/JSR+i6aA4xoM6RIVGGK1c=;\n\tb=Gw51A00TXsjiFcRTh564XmjTuqqFIgHNOTs38pBmqhh2zO5eoZnxiKkMarGWUjk9eS\n\trBzqr8tLcNJltqglcqiLfeGvlqs7AFNxwC+yIOc3dIxYjvRvuOaBxe3cbT2khSJq4UjS\n\tP/cWQXjQhi7jku0ha3rmEBKzcekCocEt+TGaqAmZrOpLWHDgMx+tUv2gaBDLIERrYmXx\n\tXcal2RDOLO/hfTai9i5rj2GxrlOkqAl1cA6SRW6dQp7iGD+hx1r2PO3jpJSRw5xWmRt8\n\trbQbXJAnP1z2+4TnhI/y1j0iwAnG+09cK/4pYchBOI7oce57Uj8PBTmk6km3mj/1o961\n\tM7Wg==","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=3FtVWARjoE+b9wG70tcBL/JSR+i6aA4xoM6RIVGGK1c=;\n\tb=Zeps1eLu9V+jq7uFMFFzv61sGiTYdyTGwqgdN3u2QUlgPQrnkXf8h6ePXOmcJqq/8E\n\tn/r5IONx5Nj8xxp3cV4eFJ6tSG+aLNahzRibAks+KKVPCtcMrQnU6sULOT+oMP3WRX5n\n\tAR166vy8yeyl428Awng4f9Avx03izRREZuSgn64Plny2cN3cLEfoh+Z2P0fuHR7QMV+7\n\t8M6UaryE9vujZO1rQs2RiobA5WYOfFi0NkomvGmnL1nau2r1Lw4wZTMSt3m+e0oRS0lQ\n\tdnnUvZwTDJ3RyLXA0IVHrlJZ2HJCO1ND0NvUB3+jgz51avW75pM5DQUocNBrQAI2AuCC\n\tmfjQ==","X-Gm-Message-State":"AHPjjUjN1Q04qwZ4s17HmMwKAR9veNarFhqaLSsFr5W4SVW3DZf06Qkw\n\twABLb8fKdls5SsFbdsAxonH/WyscCXc=","X-Google-Smtp-Source":"AOwi7QBVFAr72WiXMUTnMq2EjjAxE/u45V4Psp3fIt86wyN/Nn7kMSJfPRxK0sxY2bOkyHo59SZW3Q==","X-Received":"by 10.84.210.45 with SMTP id z42mr3567308plh.178.1505947636051; \n\tWed, 20 Sep 2017 15:47:16 -0700 (PDT)","From":"Eric Biggers <ebiggers3@gmail.com>","To":"linux-fscrypt@vger.kernel.org","Cc":"linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org,\n\tlinux-f2fs-devel@lists.sourceforge.net,\n\tlinux-mtd@lists.infradead.org, \"Theodore Y . Ts'o\" <tytso@mit.edu>,\n\tJaegeuk Kim <jaegeuk@kernel.org>, Michael Halcrow <mhalcrow@google.com>,\n\tEric Biggers <ebiggers@google.com>","Subject":"[PATCH 23/25] ubifs: switch to fscrypt_prepare_rename()","Date":"Wed, 20 Sep 2017 15:46:03 -0700","Message-Id":"<20170920224605.22030-24-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-ext4-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<linux-ext4.vger.kernel.org>","X-Mailing-List":"linux-ext4@vger.kernel.org"},"content":"From: Eric Biggers <ebiggers@google.com>\n\nSigned-off-by: Eric Biggers <ebiggers@google.com>\n---\n fs/ubifs/dir.c | 20 +++++++-------------\n 1 file changed, 7 insertions(+), 13 deletions(-)","diff":"diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c\nindex 09e6c56b11bc..7bf847d79b4a 100644\n--- a/fs/ubifs/dir.c\n+++ b/fs/ubifs/dir.c\n@@ -1353,12 +1353,6 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry,\n \tif (unlink)\n \t\tubifs_assert(inode_is_locked(new_inode));\n \n-\tif (old_dir != new_dir) {\n-\t\tif (ubifs_crypt_is_encrypted(new_dir) &&\n-\t\t    !fscrypt_has_permitted_context(new_dir, old_inode))\n-\t\t\treturn -EPERM;\n-\t}\n-\n \tif (unlink && is_dir) {\n \t\terr = ubifs_check_dir_empty(new_inode);\n \t\tif (err)\n@@ -1573,13 +1567,6 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry,\n \n \tubifs_assert(fst_inode && snd_inode);\n \n-\tif ((ubifs_crypt_is_encrypted(old_dir) ||\n-\t    ubifs_crypt_is_encrypted(new_dir)) &&\n-\t    (old_dir != new_dir) &&\n-\t    (!fscrypt_has_permitted_context(new_dir, fst_inode) ||\n-\t     !fscrypt_has_permitted_context(old_dir, snd_inode)))\n-\t\treturn -EPERM;\n-\n \terr = fscrypt_setup_filename(old_dir, &old_dentry->d_name, 0, &fst_nm);\n \tif (err)\n \t\treturn err;\n@@ -1624,12 +1611,19 @@ static int ubifs_rename(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 (flags & ~(RENAME_NOREPLACE | RENAME_WHITEOUT | RENAME_EXCHANGE))\n \t\treturn -EINVAL;\n \n \tubifs_assert(inode_is_locked(old_dir));\n \tubifs_assert(inode_is_locked(new_dir));\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 ubifs_xrename(old_dir, old_dentry, new_dir, new_dentry);\n \n","prefixes":["23/25"]}