f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
Subsystems (3)
PATCH 1/1 f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
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.
--- fs/f2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/xattr.c +1 -1
@@ -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 ;
Signature · 1 line
2.45.2
Christian Brauner
maintainerHi Rochan,
Quoted 4 lines
f2fs_xattr_advise_set()callsinode_owner_or_capable()with&nop_mnt_idmapbefore allowing the advise xattr to be set, instead of the idmap that was passed into the handler.
Quoted 8 lines
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")Signed-off-by Rochan Avlur <[email protected]>
Seems generally fine to me,
Acked-by: Christian Brauner (Amutable) <braurg>
Jaegeuk Kim
maintainerQuoted 11 lines · On 07/30, Christian Brauner via Linux-f2fs-devel wrote:
Hi Rochan,
Quoted 9 lines
f2fs_xattr_advise_set()callsinode_owner_or_capable()with&nop_mnt_idmapbefore 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.
Quoted 6 lines
Quoted 3 lines
Fixes 984fc4e76d63 ("f2fs: support idmapped mounts")Signed-off-by Rochan Avlur <[email protected]>Seems generally fine to me,
Acked-by: Christian Brauner (Amutable) <braurg>
Thanks, let me applied Acked-by: to the first submitted patch, which is same.
Quoted 9 lines
Signature · 8 lines
-- _______________________________________________ Linux-f2fs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
Chao Yu
maintainerQuoted 4 lines · Rochan Avlur
f2fs_xattr_advise_set()callsinode_owner_or_capable()with&nop_mnt_idmapbefore allowing the advise xattr to be set, instead of the idmap that was passed into the handler.
Quoted 8 lines
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")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,
Quoted 17 lines
--- fs/f2fs/xattr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/f2fs/xattr.c +1
-1@@ -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 ;
Hi Chao,
Quoted 13 lines
Quoted 4 lines
f2fs_xattr_advise_set()callsinode_owner_or_capable()with&nop_mnt_idmapbefore allowing the advise xattr to be set, instead of the idmap that was passed into the handler.Quoted 8 lines
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")Signed-off-by Rochan Avlur <[email protected]>
Quoted 5 lines
Thanks for the patch.
I notice there is already a patch:
Thanks for pointing that out. I wasn't aware of Zhan's patch when I submitted mine. Happy to defer to the earlier submission.
This patch was applied to jaegeuk/f2fs.git (dev) by Jaegeuk Kim <[email protected]>:
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <[email protected]>:
Quoted 10 lines · On Tue, 28 Jul 2026 21:16:56 -0700 you wrote:
f2fs_xattr_advise_set()callsinode_owner_or_capable()with&nop_mnt_idmapbefore 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.[...]
Here is the summary with links:
- [f2fs-dev] f2fs: use the mount idmap for the owner check in f2fs_xattr_advise_set()
https://git.kernel.org/jaegeuk/f2fs/c/a54ffce4637a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html