From: Eric Biggers <ebiggers@kernel.org>
To: stable@vger.kernel.org
Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org,
Theodore Ts'o <tytso@mit.edu>,
linux-f2fs-devel@lists.sourceforge.net
Subject: [f2fs-dev] [PATCH 4.9 2/2] fscrypt: use EEXIST when file already uses different policy
Date: Sat, 31 Oct 2020 16:11:24 -0700 [thread overview]
Message-ID: <20201031231124.1199710-3-ebiggers@kernel.org> (raw)
In-Reply-To: <20201031231124.1199710-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.com>
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 <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
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
next prev parent reply other threads:[~2020-10-31 23:13 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-31 23:11 [f2fs-dev] [PATCH 4.9 0/2] backport some more fscrypt fixes to 4.9 Eric Biggers
2020-10-31 23:11 ` [f2fs-dev] [PATCH 4.9 1/2] fscrypto: move ioctl processing more fully into common code Eric Biggers
2020-10-31 23:11 ` Eric Biggers [this message]
2020-11-01 10:32 ` [f2fs-dev] [PATCH 4.9 0/2] backport some more fscrypt fixes to 4.9 Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201031231124.1199710-3-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-ext4@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-fscrypt@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tytso@mit.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).