From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28E4AC388F7 for ; Sat, 31 Oct 2020 23:13:21 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C0E0720885; Sat, 31 Oct 2020 23:13:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sourceforge.net header.i=@sourceforge.net header.b="dtj/3/Ic"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sf.net header.i=@sf.net header.b="Lu0R4mfU"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="ZYVLm8TG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C0E0720885 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1kZ03i-0003Jc-43; Sat, 31 Oct 2020 23:13:18 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kZ03h-0003JD-6L for linux-f2fs-devel@lists.sourceforge.net; Sat, 31 Oct 2020 23:13:17 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=DLG+T2t2bsrw5HivqhspV9heIsN5AZgAKYc2lEbwQRI=; b=dtj/3/Ic/jk9tK1qJzklTh3BAm eZdI2j/IBnEw5QG8RaI6CTxPxBiV2884qknzhIPERUdTCBna1eMsZXoR5+IXHb70+nACcQdK2sdew Aof/Z/5z9DWmb0kXQBjEsbmPPD2DoLbX08gvBWPU5BJqIHR35gzezi+NcfBDXjBq8/1s=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DLG+T2t2bsrw5HivqhspV9heIsN5AZgAKYc2lEbwQRI=; b=Lu0R4mfUNRpEKV7C36oEoGNd/q B3QTnSutFyZgYTTlAbP8HGP3IEx5hdPajhqzUDQ0+/Fnhhh5wDinTWynDbp1Q1peGVwnTEaphR1rl GM8hGOYpsQZndsfMvrjckCFe0ZpbtHgoGRbu1CbDCjWgEE9RHPDjcNgwPfuUDpUBQZwE=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1kZ03f-00EfGY-3b for linux-f2fs-devel@lists.sourceforge.net; Sat, 31 Oct 2020 23:13:17 +0000 Received: from sol.attlocal.net (172-10-235-113.lightspeed.sntcca.sbcglobal.net [172.10.235.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CC14E208B6; Sat, 31 Oct 2020 23:13:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604185983; bh=5YTncnfxoiRc+Gm3gLawwFHq1F8Nr63JtIwvhMbDln0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZYVLm8TGbc/oHq4jfcNvT6eqaZiEPw5eUZauowUvu6cuHnDuVPBi4FeFkNXQD1lSg TToeokDPVFnlpy5cfblQBbhQlhOWRHuMpIXZJAQga5CuDxXBLmtF1829KBsVD5oQiB cbbWzEuf+J82q5dY4f4BNAiWYr07arhzXdv7zhB8= From: Eric Biggers To: stable@vger.kernel.org Date: Sat, 31 Oct 2020 16:11:24 -0700 Message-Id: <20201031231124.1199710-3-ebiggers@kernel.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201031231124.1199710-1-ebiggers@kernel.org> References: <20201031231124.1199710-1-ebiggers@kernel.org> MIME-Version: 1.0 X-Headers-End: 1kZ03f-00EfGY-3b Subject: [f2fs-dev] [PATCH 4.9 2/2] fscrypt: use EEXIST when file already uses different policy X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, Theodore Ts'o , linux-f2fs-devel@lists.sourceforge.net Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net From: Eric Biggers commit 8488cd96ff88966ccb076e4f3654f59d84ba686d upstream. As part of an effort to clean up fscrypt-related error codes, make FS_IOC_SET_ENCRYPTION_POLICY fail with EEXIST when the file already uses a different encryption policy. This is more descriptive than EINVAL, which was ambiguous with some of the other error cases. I am not aware of any users who might be relying on the previous error code of EINVAL, which was never documented anywhere. This failure case will be exercised by an xfstest. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o --- fs/crypto/policy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index a89e50331deb6..2bf6e0a2a57ca 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -131,7 +131,7 @@ int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg) printk(KERN_WARNING "%s: Policy inconsistent with encryption context\n", __func__); - ret = -EINVAL; + ret = -EEXIST; } inode_unlock(inode); -- 2.29.1 _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel