Skip to content

Commit b651251

Browse files
Christoph Hellwigbrauner
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 088f294 commit b651251

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

fs/fcntl.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ static long fcntl_set_rw_hint(struct file *file, unsigned int cmd,
374374
u64 __user *argp = (u64 __user *)arg;
375375
u64 hint;
376376

377+
if (!inode_owner_or_capable(file_mnt_idmap(file), inode))
378+
return -EPERM;
379+
377380
if (copy_from_user(&hint, argp, sizeof(hint)))
378381
return -EFAULT;
379382
if (!rw_hint_valid(hint))

0 commit comments

Comments
 (0)