summaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2022-12-12 10:47:03 -0800
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2022-12-12 10:47:03 -0800
commite291c116f60f3c1ca98090f0f8e7c77e658562fb (patch)
tree2fbe810f2a6f8b29f1cdaefd87b24debbfa0ec07 /fs/namespace.c
parent8c9a59939deb4bfafdc451100c03d1e848b4169b (diff)
parentc3991107a28a5ad0bd90660ca3bbf8c2c220ea98 (diff)
downloadlinux-e291c116f60f3c1ca98090f0f8e7c77e658562fb.tar.bz2
Merge branch 'next' into for-linus
Prepare input updates for 6.2 merge window.
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 68789f896f08..df137ba19d37 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -4238,6 +4238,13 @@ static int build_mount_idmapped(const struct mount_attr *attr, size_t usize,
err = -EPERM;
goto out_fput;
}
+
+ /* We're not controlling the target namespace. */
+ if (!ns_capable(mnt_userns, CAP_SYS_ADMIN)) {
+ err = -EPERM;
+ goto out_fput;
+ }
+
kattr->mnt_userns = get_user_ns(mnt_userns);
out_fput: