From patchwork Fri Sep 8 00:12:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Halcrow X-Patchwork-Id: 811273 X-Patchwork-Delegate: richard@nod.at 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="E8J8RwCX"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="QZ5fy9eq"; 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 3xpHsT2yT0z9s81 for ; Fri, 8 Sep 2017 10:15:41 +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=VVTfGinn/QGREayhe09DiSp3TVCvI6xwhQcvm+YIcNA=; b=E8J8RwCXsI/O3780uMuU0+v5Qk 5yhuKMKwZ12oCq+GhsIz9qngjrx2hrFef+n/LGC+tjCamuIllCkeO5aoc9zQc7ouuhxY+6/zZRDeI A7Uyxglzru4Mhwyr8HTkjgJPHzhSuM8xMWiI2W1nPeR4Sp1z0l1B7oU9NMEgPMXFipna3ToIlUgkO ECxsj4ZXRLg+fdEoVUDZsHDAnOLYvv8Urs0JRS9if+nXDyohCEVlWf78lRxWhiErU+D0Ai68RqcKK f2UGMlwdRqI57csPoMTAQ3u+vWdhfWhl8HBCeTpP+eeIGfUVmV6LCUVWam8Qfnu4BmNzxB35iqkJK qLcbN4tA==; 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 1dq6xI-0000rD-9x; Fri, 08 Sep 2017 00:15:32 +0000 Received: from mail-pg0-x234.google.com ([2607:f8b0:400e:c05::234]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dq6un-0006qy-DU for linux-mtd@lists.infradead.org; Fri, 08 Sep 2017 00:13:00 +0000 Received: by mail-pg0-x234.google.com with SMTP id m9so2117094pgd.3 for ; Thu, 07 Sep 2017 17:12:37 -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=qDjywoq7Vkn7rFJB7qZ7l3QEG4VNF8mMs4cBtXwCfq0=; b=QZ5fy9eq6+/nFtZjgrqpDue+frA+q8wasI1uuQtSVhKDkm3q+h7Se8c/L+IVVAfvQl JZWUEmeCL+VR8QvOx35cYG1cyhB1ZEs80FSrgi7hkcvf/vgmMQUb4bxTkeUJ9Tsyqe7E LJhyTGujzQ7KWNar5SNKdXU2qmTwNbtNmeTkj+Mk3S4Gks5SOOnvafxpLVXJoRUH+FyS Bs1ZFhq9WHgbD+rpFUZXgoggg+hsnbza5j/BQ2wo5Y3lIrcNsntkuSkQiwUr4l7BxM/D 3JpV3CVMfGloOGxTrSf5WAOn5xWTVDQ0L53PRx7WwBFre8cnPFyLoh+56kSt9lw7swUJ FnlQ== 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=qDjywoq7Vkn7rFJB7qZ7l3QEG4VNF8mMs4cBtXwCfq0=; b=jgiyA9DDxuyH7XiNjHah/b8/esVBYf7f+/KahbKyF44GfEjadtKU2vmY8eA4J2gqkV G2q5uyqEXoFPC4LalKz5v2VkzSSSBXHEPqxGuGAeGvQecf8Nt+UiqLy6T04B4YLvF1Vt Hv2qjBSzVaB3cTuWjf/OwBM/9TRo8x/3amyteylEx4mlpyM7FvRmRpr3Xe4mRpISTh/1 cTbTXsVf5H06yH8CGpPgPEFBp6QbpijlcNgUVRNfaAx+gWDcsjZLCibtcyufUWEHsmja oBmBvPXuWLQ8V65n5XokMgVsKLUkOQR2LxxCT4Atb+M+y/EAiISoq7t7f7OVfNzttoR3 xIWw== X-Gm-Message-State: AHPjjUhjiG3ndTacbak1qHvTGqFGoI5PpCH8EYnWjRxMQFGMOBsckB2Z H/jII+OJm9xM+ARm X-Google-Smtp-Source: ADKCNb4QfNMNxfw8TbCVeDqp1WNCcaEoHB4z7idGyPhInLTE1pHpNfqRl1X7WnoHEnb506ZiXvxB/A== X-Received: by 10.98.248.71 with SMTP id c7mr1158757pfm.129.1504829557244; Thu, 07 Sep 2017 17:12:37 -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.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Sep 2017 17:12:36 -0700 (PDT) From: Michael Halcrow To: linux-fscrypt@vger.kernel.org Subject: [PATCH 3/3] UBIFS crypto: Return -EXDEV for link, rename, and cross-rename between incompat contexts Date: Thu, 7 Sep 2017 17:12:04 -0700 Message-Id: <20170908001204.18174-4-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170907_171257_702111_B14FC7EE X-CRM114-Status: UNSURE ( 8.56 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.5 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.5 points) 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:234 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 2.5 SUSPICIOUS_RECIPS Similar addresses in recipient list -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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: linux-fsdevel@vger.kernel.org, linux-mtd@lists.infradead.org, linux-ext4@vger.kernel.org, tytso@mit.edu, linux-f2fs-devel@lists.sourceforge.net MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Gives user space the opportunity to fall back to copy-and-delete. Signed-off-by: Michael Halcrow --- fs/ubifs/dir.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 417fe0b29f23..6c5753a2f79f 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -745,7 +745,7 @@ static int ubifs_link(struct dentry *old_dentry, struct inode *dir, if (ubifs_crypt_is_encrypted(dir) && !fscrypt_has_permitted_context(dir, inode)) - return -EPERM; + return -EXDEV; err = fscrypt_setup_filename(dir, &dentry->d_name, 0, &nm); if (err) @@ -1356,7 +1356,7 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, if (old_dir != new_dir) { if (ubifs_crypt_is_encrypted(new_dir) && !fscrypt_has_permitted_context(new_dir, old_inode)) - return -EPERM; + return -EXDEV; } if (unlink && is_dir) { @@ -1578,7 +1578,7 @@ static int ubifs_xrename(struct inode *old_dir, struct dentry *old_dentry, (old_dir != new_dir) && (!fscrypt_has_permitted_context(new_dir, fst_inode) || !fscrypt_has_permitted_context(old_dir, snd_inode))) - return -EPERM; + return -EXDEV; err = fscrypt_setup_filename(old_dir, &old_dentry->d_name, 0, &fst_nm); if (err)