path: root/fs/kernfs
diff options
authorChristian Brauner <>2021-01-21 14:19:24 +0100
committerChristian Brauner <>2021-01-24 14:27:16 +0100
commit47291baa8ddfdae10663624ff0a15ab165952708 (patch)
tree132a9486b82c5eada1c4b375f693522f0a04d629 /fs/kernfs
parent0558c1bf5a0811bf5e3753eed911a15b9bd08271 (diff)
namei: make permission helpers idmapped mount aware
The two helpers inode_permission() and generic_permission() are used by the vfs to perform basic permission checking by verifying that the caller is privileged over an inode. In order to handle idmapped mounts we extend the two helpers with an additional user namespace argument. On idmapped mounts the two helpers will make sure to map the inode according to the mount's user namespace and then peform identical permission checks to inode_permission() and generic_permission(). If the initial user namespace is passed nothing changes so non-idmapped mounts will see identical behavior as before. Link: Cc: Christoph Hellwig <> Cc: David Howells <> Cc: Al Viro <> Cc: Reviewed-by: Christoph Hellwig <> Reviewed-by: James Morris <> Acked-by: Serge Hallyn <> Signed-off-by: Christian Brauner <>
Diffstat (limited to 'fs/kernfs')
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/kernfs/inode.c b/fs/kernfs/inode.c
index fc2469a20fed..ff5598cc1de0 100644
--- a/fs/kernfs/inode.c
+++ b/fs/kernfs/inode.c
@@ -285,7 +285,7 @@ int kernfs_iop_permission(struct inode *inode, int mask)
kernfs_refresh_inode(kn, inode);
- return generic_permission(inode, mask);
+ return generic_permission(&init_user_ns, inode, mask);
int kernfs_xattr_get(struct kernfs_node *kn, const char *name,