* [PATCH next] fs: tighten a sanity check in file_attr_to_fileattr()
@ 2025-07-15 23:03 Dan Carpenter
2025-07-16 8:22 ` Christian Brauner
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-07-15 23:03 UTC (permalink / raw)
To: Andrey Albershteyn
Cc: Alexander Viro, Christian Brauner, Jan Kara, Arnd Bergmann,
linux-fsdevel, linux-kernel, kernel-janitors
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: be7efb2d20d6 ("fs: introduce file_getattr and file_setattr syscalls")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
fs/file_attr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/file_attr.c b/fs/file_attr.c
index 17745c89e2be..12424d4945d0 100644
--- a/fs/file_attr.c
+++ b/fs/file_attr.c
@@ -136,7 +136,7 @@ EXPORT_SYMBOL(copy_fsxattr_to_user);
static int file_attr_to_fileattr(const struct file_attr *fattr,
struct file_kattr *fa)
{
- __u32 mask = FS_XFLAGS_MASK;
+ __u64 mask = FS_XFLAGS_MASK;
if (fattr->fa_xflags & ~mask)
return -EINVAL;
--
2.47.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH next] fs: tighten a sanity check in file_attr_to_fileattr()
2025-07-15 23:03 [PATCH next] fs: tighten a sanity check in file_attr_to_fileattr() Dan Carpenter
@ 2025-07-16 8:22 ` Christian Brauner
0 siblings, 0 replies; 2+ messages in thread
From: Christian Brauner @ 2025-07-16 8:22 UTC (permalink / raw)
To: Andrey Albershteyn, Dan Carpenter
Cc: Christian Brauner, Alexander Viro, Jan Kara, Arnd Bergmann,
linux-fsdevel, linux-kernel, kernel-janitors
On Tue, 15 Jul 2025 18:03:17 -0500, Dan Carpenter wrote:
> 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.
>
>
> [...]
Applied to the vfs-6.17.fileattr branch of the vfs/vfs.git tree.
Patches in the vfs-6.17.fileattr branch should appear in linux-next soon.
Please report any outstanding bugs that were missed during review in a
new review to the original patch series allowing us to drop it.
It's encouraged to provide Acked-bys and Reviewed-bys even though the
patch has now been applied. If possible patch trailers will be updated.
Note that commit hashes shown below are subject to change due to rebase,
trailer updates or similar. If in doubt, please check the listed branch.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs-6.17.fileattr
[1/1] fs: tighten a sanity check in file_attr_to_fileattr()
https://git.kernel.org/vfs/vfs/c/e85931d1cd69
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-07-16 8:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-15 23:03 [PATCH next] fs: tighten a sanity check in file_attr_to_fileattr() Dan Carpenter
2025-07-16 8:22 ` Christian Brauner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).