diff options
author | 2024-11-22 13:29:24 +0100 | |
---|---|---|
committer | 2024-11-25 15:16:49 +0100 | |
commit | b6512519496e29270bca6b2df9baa3cc2d9d5356 (patch) | |
tree | a96614ea80a91df71b28a925d8af8f8b03da8376 | |
parent | fs/proc/kcore.c: Clear ret value in read_kcore_iter after successful iov_iter_zero (diff) | |
download | wireguard-linux-b6512519496e29270bca6b2df9baa3cc2d9d5356.tar.xz wireguard-linux-b6512519496e29270bca6b2df9baa3cc2d9d5356.zip |
fs: require inode_owner_or_capable for F_SET_RW_HINT
F_SET_RW_HINT controls data placement in the file system and / or
device and should not be available to everyone who can read a given file.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20241122122931.90408-2-hch@lst.de
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r-- | fs/fcntl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/fcntl.c b/fs/fcntl.c index ac77dd912412..49884fa3c81d 100644 --- a/fs/fcntl.c +++ b/fs/fcntl.c @@ -374,6 +374,9 @@ static long fcntl_set_rw_hint(struct file *file, unsigned int cmd, u64 __user *argp = (u64 __user *)arg; u64 hint; + if (!inode_owner_or_capable(file_mnt_idmap(file), inode)) + return -EPERM; + if (copy_from_user(&hint, argp, sizeof(hint))) return -EFAULT; if (!rw_hint_valid(hint)) |