mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 05:24:39 +01:00
fs: reset read-only fsflags together with xflags
While setting file attributes, the read-only flags are reset for ->xflags, but not for ->flags if flag is shared between both. This is fine for now as all read-only xflags don't overlap with flags. However, for any read-only shared flag this will create inconsistency between xflags and flags. The non-shared flag will be reset in vfs_fileattr_set() to the current value, but shared one is past further to ->fileattr_set. Reported-by: Eric Biggers <ebiggers@kernel.org> Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org> Link: https://patch.msgid.link/20260121193645.3611716-1-aalbersh@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
fc94368bce
commit
9396bfdacb
1 changed files with 2 additions and 4 deletions
|
|
@ -141,8 +141,7 @@ static int file_attr_to_fileattr(const struct file_attr *fattr,
|
|||
if (fattr->fa_xflags & ~mask)
|
||||
return -EINVAL;
|
||||
|
||||
fileattr_fill_xflags(fa, fattr->fa_xflags);
|
||||
fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
|
||||
fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
|
||||
fa->fsx_extsize = fattr->fa_extsize;
|
||||
fa->fsx_projid = fattr->fa_projid;
|
||||
fa->fsx_cowextsize = fattr->fa_cowextsize;
|
||||
|
|
@ -162,8 +161,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
|
|||
if (xfa.fsx_xflags & ~mask)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
fileattr_fill_xflags(fa, xfa.fsx_xflags);
|
||||
fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK;
|
||||
fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
|
||||
fa->fsx_extsize = xfa.fsx_extsize;
|
||||
fa->fsx_nextents = xfa.fsx_nextents;
|
||||
fa->fsx_projid = xfa.fsx_projid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue