Merge tag 'core-entry-2020-12-14' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / nsproxy.c
index 12dd41b..abc01fc 100644 (file)
@@ -153,7 +153,6 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
        struct nsproxy *old_ns = tsk->nsproxy;
        struct user_namespace *user_ns = task_cred_xxx(tsk, user_ns);
        struct nsproxy *new_ns;
-       int ret;
 
        if (likely(!(flags & (CLONE_NEWNS | CLONE_NEWUTS | CLONE_NEWIPC |
                              CLONE_NEWPID | CLONE_NEWNET |
@@ -173,18 +172,14 @@ int copy_namespaces(unsigned long flags, struct task_struct *tsk)
         * it along with CLONE_NEWIPC.
         */
        if ((flags & (CLONE_NEWIPC | CLONE_SYSVSEM)) ==
-               (CLONE_NEWIPC | CLONE_SYSVSEM)) 
+               (CLONE_NEWIPC | CLONE_SYSVSEM))
                return -EINVAL;
 
        new_ns = create_new_namespaces(flags, tsk, user_ns, tsk->fs);
        if (IS_ERR(new_ns))
                return  PTR_ERR(new_ns);
 
-       ret = timens_on_fork(new_ns, tsk);
-       if (ret) {
-               free_nsproxy(new_ns);
-               return ret;
-       }
+       timens_on_fork(new_ns, tsk);
 
        tsk->nsproxy = new_ns;
        return 0;
@@ -250,8 +245,8 @@ void switch_task_namespaces(struct task_struct *p, struct nsproxy *new)
        p->nsproxy = new;
        task_unlock(p);
 
-       if (ns && atomic_dec_and_test(&ns->count))
-               free_nsproxy(ns);
+       if (ns)
+               put_nsproxy(ns);
 }
 
 void exit_task_namespaces(struct task_struct *p)