diff --git a/fs/namespace.c b/fs/namespace.c index 61c88343cc9456efdb1eb73d70b72327c5cffbda..000dc921e810f7c0034ea3b505d85ffdc8f34986 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -1959,6 +1959,11 @@ struct vfsmount *clone_private_mount(const struct path *path) if (!check_mnt(old_mnt)) goto invalid; + if (!ns_capable(old_mnt->mnt_ns->user_ns, CAP_SYS_ADMIN)) { + up_read(&namespace_sem); + return ERR_PTR(-EPERM); + } + if (has_locked_children(old_mnt, path->dentry)) goto invalid; @@ -2311,6 +2316,10 @@ static int do_change_type(struct path *path, int ms_flags) return -EINVAL; namespace_lock(); + if (!check_mnt(mnt)) { + err = -EINVAL; + goto out_unlock; + } if (type == MS_SHARED) { err = invent_group_ids(mnt, recurse); if (err)