Skip to content

Commit e85931d

Browse files
Dan Carpenterbrauner
authored andcommitted
fs: tighten a sanity check in file_attr_to_fileattr()
The fattr->fa_xflags is a u64 that comes from the user. This is a sanity check to ensure that the users are only setting allowed flags. The problem is that it doesn't check the upper 32 bits. It doesn't really affect anything but for more flexibility in the future, we want to enforce users zero out those bits. Fixes: be7efb2 ("fs: introduce file_getattr and file_setattr syscalls") Signed-off-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent ca115d7 commit e85931d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/file_attr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ EXPORT_SYMBOL(copy_fsxattr_to_user);
136136
static int file_attr_to_fileattr(const struct file_attr *fattr,
137137
struct file_kattr *fa)
138138
{
139-
__u32 mask = FS_XFLAGS_MASK;
139+
__u64 mask = FS_XFLAGS_MASK;
140140

141141
if (fattr->fa_xflags & ~mask)
142142
return -EINVAL;

0 commit comments

Comments
 (0)