OSDN Git Service

Merge tag 'threads-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/brauner...
[tomoyo/tomoyo-test1.git] / fs / namespace.c
index a6baee3..6d499ab 100644 (file)
@@ -1786,6 +1786,11 @@ static struct mnt_namespace *to_mnt_ns(struct ns_common *ns)
        return container_of(ns, struct mnt_namespace, ns);
 }
 
+struct ns_common *from_mnt_ns(struct mnt_namespace *mnt)
+{
+       return &mnt->ns;
+}
+
 static bool mnt_ns_loop(struct dentry *dentry)
 {
        /* Could bind mounting the mount namespace inode cause a
@@ -4013,16 +4018,18 @@ static void mntns_put(struct ns_common *ns)
        put_mnt_ns(to_mnt_ns(ns));
 }
 
-static int mntns_install(struct nsproxy *nsproxy, struct ns_common *ns)
+static int mntns_install(struct nsset *nsset, struct ns_common *ns)
 {
-       struct fs_struct *fs = current->fs;
+       struct nsproxy *nsproxy = nsset->nsproxy;
+       struct fs_struct *fs = nsset->fs;
        struct mnt_namespace *mnt_ns = to_mnt_ns(ns), *old_mnt_ns;
+       struct user_namespace *user_ns = nsset->cred->user_ns;
        struct path root;
        int err;
 
        if (!ns_capable(mnt_ns->user_ns, CAP_SYS_ADMIN) ||
-           !ns_capable(current_user_ns(), CAP_SYS_CHROOT) ||
-           !ns_capable(current_user_ns(), CAP_SYS_ADMIN))
+           !ns_capable(user_ns, CAP_SYS_CHROOT) ||
+           !ns_capable(user_ns, CAP_SYS_ADMIN))
                return -EPERM;
 
        if (is_anon_ns(mnt_ns))