summaryrefslogtreecommitdiff
path: root/fs/namespace.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-09-01 19:21:27 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2022-09-01 19:21:27 -0400
commit29250ba51bc1cbe8a87e923f76978b87c3247a8c (patch)
treeb6afc83e580ae3b746aa530434f56bb6fb80cc8b /fs/namespace.c
parent35906d23cf036857738d49b0d9388376145dc017 (diff)
parentca922fecda6caa5162409406dc3b663062d75089 (diff)
Merge tag 'kvm-s390-master-6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
PCI interpretation compile fixes
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: