mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
fcntl: refuse F_SET_RW_HINT on an immutable inode
An immutable inode is never written to so write hints are pointless.
Refuse the hint on an immutable inode the way setattr(), fallocate() and
etxattr() refuse their changes.
Fixes: c75b1d9421 ("fs: add fcntl() interface for setting/getting write life time hints")
Cc: [email protected]
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Christian Brauner (Amutable) <[email protected]>
This commit is contained in:
@@ -372,6 +372,9 @@ static long fcntl_set_rw_hint(struct file *file, unsigned long arg)
|
||||
u64 __user *argp = (u64 __user *)arg;
|
||||
u64 hint;
|
||||
|
||||
/* nothing is ever written to it */
|
||||
if (IS_IMMUTABLE(inode))
|
||||
return -EPERM;
|
||||
if (!inode_owner_or_capable(file_mnt_idmap(file), inode))
|
||||
return -EPERM;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user