Merge tag 'md/3.12' of git://neil.brown.name/md
[firefly-linux-kernel-4.4.55.git] / kernel / fork.c
index e23bb19e2a3e23c9d3ad3c68e0f49acb214d3e51..c9eaf20130021fbe3c8b24f4634ff7cd0ef02c3f 100644 (file)
@@ -1177,7 +1177,8 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         * don't allow the creation of threads.
         */
        if ((clone_flags & (CLONE_VM|CLONE_NEWPID)) &&
-           (task_active_pid_ns(current) != current->nsproxy->pid_ns))
+           (task_active_pid_ns(current) !=
+            current->nsproxy->pid_ns_for_children))
                return ERR_PTR(-EINVAL);
 
        retval = security_task_create(clone_flags);
@@ -1351,7 +1352,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 
        if (pid != &init_struct_pid) {
                retval = -ENOMEM;
-               pid = alloc_pid(p->nsproxy->pid_ns);
+               pid = alloc_pid(p->nsproxy->pid_ns_for_children);
                if (!pid)
                        goto bad_fork_cleanup_io;
        }
@@ -1823,11 +1824,6 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
         */
        if (unshare_flags & CLONE_NEWUSER)
                unshare_flags |= CLONE_THREAD | CLONE_FS;
-       /*
-        * If unsharing a pid namespace must also unshare the thread.
-        */
-       if (unshare_flags & CLONE_NEWPID)
-               unshare_flags |= CLONE_THREAD;
        /*
         * If unsharing a thread from a thread group, must also unshare vm.
         */