From patchwork Fri Sep 8 00:12:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Halcrow X-Patchwork-Id: 9943005 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 25106600CB for ; Fri, 8 Sep 2017 00:12:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CE5027C0B for ; Fri, 8 Sep 2017 00:12:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 11E4027DA4; Fri, 8 Sep 2017 00:12:39 +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=-4.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, RCVD_IN_DNSWL_HI, SUSPICIOUS_RECIPS, 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 B077427C0B for ; Fri, 8 Sep 2017 00:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753052AbdIHAMh (ORCPT ); Thu, 7 Sep 2017 20:12:37 -0400 Received: from mail-pg0-f41.google.com ([74.125.83.41]:38217 "EHLO mail-pg0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752663AbdIHAMf (ORCPT ); Thu, 7 Sep 2017 20:12:35 -0400 Received: by mail-pg0-f41.google.com with SMTP id v66so2086896pgb.5 for ; Thu, 07 Sep 2017 17:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=VzkLSlJeRYCLVLtHBOnDTxgB9u1PqKbInpwTOtVP8ew=; b=Ice0QMtgOPM3VaTp8Vrr2EfumHDDeKVnQCPZKM+z5v1EPtyaytZX/2fg1wehZzUuz8 BPO6+BseSzrqBbJuc/4/GAc2Bi/YNF1G6jaAU0ycfCOho/7TjQvKfIMtLHcDpYjXQ4cj 9+7dTFrtUmFoa1S9H6BkPUXMpcieioONW+UaT0P4bFgYAW5n8kWItpTfS3Tjm60njQRt RV3WV9Kn0o+tjlHFo16o9XhyQ7XrBrXcpLetzGEfzbCBhXNyH8WNY70ST6EmFAi5OqnF AlzumS3TqwfrOIdnJ9lfDUWhAOnKgJrL1YcvWORyRdzn7aIUprEortQK9uKqvyciiNeI DALA== 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=VzkLSlJeRYCLVLtHBOnDTxgB9u1PqKbInpwTOtVP8ew=; b=ESbrvtvGvrGL9q/e7cVxuF5G9utiulVzvP2u/Wluk4fgdoTuNarAZO/AZsA+NBMFWZ 0T5TG9A/whc003rjxmqQEY48yBn1j/pS1FbZw0i5LxPu7npcnkWuTeCYzJl8gQKvW4m5 RoirQWT/+yuykTcuGe/4sYdz8rrVjd9M9p9tVH8RB6gr2Rs5r2uuRabsKUXE6eQoa/nV 04oo5iPNxBNxYk1ZIAEBgDSKygB63dOIek6yFO9GP8vuTIQU3M+RRWQq7uO+hN6UIiM6 ZE4YAVW1Yzc/rz+zc0vZuvg1BBwvlPVaReEurJVIOfqk0A9Onc9Bcst13WRd3P0m3TvJ G7sA== X-Gm-Message-State: AHPjjUj5oL338VJznP/afKCr9IStFJvaVKt2lgr6xcXZOocy25igY6FL xbmTQbdg7KVhjW74AdKL+Q== X-Google-Smtp-Source: ADKCNb77OBNGz8iqrYgB9/+r49OFHEniG2dVLtNf2S2/yzWYKxQ7LZeRnjSt29F8cd6gPZLVWnb7kA== X-Received: by 10.98.15.208 with SMTP id 77mr1189693pfp.318.1504829555043; Thu, 07 Sep 2017 17:12:35 -0700 (PDT) Received: from mhalcrow-linux.kir.corp.google.com ([100.66.175.61]) by smtp.gmail.com with ESMTPSA id d25sm1007805pfb.1.2017.09.07.17.12.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Sep 2017 17:12:34 -0700 (PDT) From: Michael Halcrow To: linux-fscrypt@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org, tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org Subject: [PATCH 2/3] F2FS crypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts Date: Thu, 7 Sep 2017 17:12:03 -0700 Message-Id: <20170908001204.18174-3-mhalcrow@google.com> X-Mailer: git-send-email 2.14.1.581.gf28d330327-goog In-Reply-To: <20170908001204.18174-1-mhalcrow@google.com> References: <20170908001204.18174-1-mhalcrow@google.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 Gives user space the opportunity to fall back to copy-and-delete. Signed-off-by: Michael Halcrow --- fs/f2fs/namei.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/f2fs/namei.c b/fs/f2fs/namei.c index 760d85223c81..689c671cf8b8 100644 --- a/fs/f2fs/namei.c +++ b/fs/f2fs/namei.c @@ -202,7 +202,7 @@ static int f2fs_link(struct dentry *old_dentry, struct inode *dir, if (f2fs_encrypted_inode(dir) && !fscrypt_has_permitted_context(dir, inode)) - return -EPERM; + return -EXDEV; err = dquot_initialize(dir); if (err) @@ -720,7 +720,7 @@ static int f2fs_rename(struct inode *old_dir, struct dentry *old_dentry, if ((old_dir != new_dir) && f2fs_encrypted_inode(new_dir) && !fscrypt_has_permitted_context(new_dir, old_inode)) { - err = -EPERM; + err = -EXDEV; goto out; } @@ -910,7 +910,7 @@ static int f2fs_cross_rename(struct inode *old_dir, struct dentry *old_dentry, (old_dir != new_dir) && (!fscrypt_has_permitted_context(new_dir, old_inode) || !fscrypt_has_permitted_context(old_dir, new_inode))) - return -EPERM; + return -EXDEV; err = dquot_initialize(old_dir); if (err)