Re: [PATCH] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()

Chao Yu <[email protected]>
Newsgroups gmane.linux.kernel.stable,gmane.linux.file-systems.f2fs,gmane.linux.file-systems,gmane.linux.kernel
Message-ID <[email protected]>
On 7/29/26 12:16, Rochan Avlur wrote:
> f2fs_xattr_advise_set() calls inode_owner_or_capable() with
> &nop_mnt_idmap before allowing the advise xattr to be set, instead of
> the idmap that was passed into the handler.
> 
> Since f2fs supports idmapped mounts, this compares the caller's fsuid
> against the unmapped on-disk owner rather than the mapped owner; resulting
> in the actual owner to be wrongly denied with -EPERM. Use the idmap
> argument that was already passed to the xattr handler instead.
> 
> Fixes: 984fc4e76d63 ("f2fs: support idmapped mounts")
> Cc: [email protected]
> Signed-off-by: Rochan Avlur <[email protected]>

Thanks for the patch.

I notice there is already a patch:

https://lore.kernel.org/linux-f2fs-devel/[email protected]

Thanks,

> ---
>   fs/f2fs/xattr.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 610d5810074d..281e2fd6c778 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -118,7 +118,7 @@ static int f2fs_xattr_advise_set(const struct xattr_handler *handler,
>   	unsigned char old_advise = F2FS_I(inode)->i_advise;
>   	unsigned char new_advise;
>   
> -	if (!inode_owner_or_capable(&nop_mnt_idmap, inode))
> +	if (!inode_owner_or_capable(idmap, inode))
>   		return -EPERM;
>   	if (value == NULL)
>   		return -EINVAL;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.