]> Git Repo - linux.git/commitdiff
fs: require inode_owner_or_capable for F_SET_RW_HINT
authorChristoph Hellwig <[email protected]>
Fri, 22 Nov 2024 12:29:24 +0000 (13:29 +0100)
committerChristian Brauner <[email protected]>
Mon, 25 Nov 2024 14:16:49 +0000 (15:16 +0100)
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]>
fs/fcntl.c

index ac77dd912412ef0270c6e63a40a4ba6485fec97c..49884fa3c81d2e09309eedfcd811eba2d8dbbb73 100644 (file)
@@ -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))
This page took 0.055495 seconds and 4 git commands to generate.