summaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2021-05-24 13:43:56 -0400
committerTejun Heo <tj@kernel.org>2021-05-24 13:43:56 -0400
commitc2a11971549b16a24cce81250d84b63d53499fd0 (patch)
tree7bfa4b1c61ec5ad44834a3e38da3d4958517a00f /fs/namespace.c
parentf4f809f66b7545b89bff4b132cdb37adc2d2c157 (diff)
parent08b2b6fdf6b26032f025084ce2893924a0cdb4a2 (diff)
Merge branch 'for-5.13-fixes' into for-5.14
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index f63337828e1c..c3f1a78ba369 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -3855,8 +3855,12 @@ static int can_idmap_mount(const struct mount_kattr *kattr, struct mount *mnt)
if (!(m->mnt_sb->s_type->fs_flags & FS_ALLOW_IDMAP))
return -EINVAL;
+ /* Don't yet support filesystem mountable in user namespaces. */
+ if (m->mnt_sb->s_user_ns != &init_user_ns)
+ return -EINVAL;
+
/* We're not controlling the superblock. */
- if (!ns_capable(m->mnt_sb->s_user_ns, CAP_SYS_ADMIN))
+ if (!capable(CAP_SYS_ADMIN))
return -EPERM;
/* Mount has already been visible in the filesystem hierarchy. */