Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Andrey Albershteyn and committed by
Christian Brauner
9396bfda fc94368b

+2 -4
+2 -4
fs/file_attr.c
··· 141 141 if (fattr->fa_xflags & ~mask) 142 142 return -EINVAL; 143 143 144 - fileattr_fill_xflags(fa, fattr->fa_xflags); 145 - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK; 144 + fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK); 146 145 fa->fsx_extsize = fattr->fa_extsize; 147 146 fa->fsx_projid = fattr->fa_projid; 148 147 fa->fsx_cowextsize = fattr->fa_cowextsize; ··· 161 162 if (xfa.fsx_xflags & ~mask) 162 163 return -EOPNOTSUPP; 163 164 164 - fileattr_fill_xflags(fa, xfa.fsx_xflags); 165 - fa->fsx_xflags &= ~FS_XFLAG_RDONLY_MASK; 165 + fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK); 166 166 fa->fsx_extsize = xfa.fsx_extsize; 167 167 fa->fsx_nextents = xfa.fsx_nextents; 168 168 fa->fsx_projid = xfa.fsx_projid;