kexec: prevent double free on image allocation failure
[deliverable/linux.git] / kernel / fork.c
index 4ff724f81f2529b6fe206f6fa081198cc3f0d70a..8d932b1c9056af738e2903bf813bcbd035ed3892 100644 (file)
@@ -1233,6 +1233,12 @@ static struct task_struct *copy_process(unsigned long clone_flags,
 #ifndef CONFIG_VIRT_CPU_ACCOUNTING
        p->prev_cputime.utime = p->prev_cputime.stime = 0;
 #endif
+#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
+       seqlock_init(&p->vtime_seqlock);
+       p->vtime_snap = 0;
+       p->vtime_snap_whence = VTIME_SLEEPING;
+#endif
+
 #if defined(SPLIT_RSS_COUNTING)
        memset(&p->rss_stat, 0, sizeof(p->rss_stat));
 #endif
@@ -1855,10 +1861,8 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
                        exit_sem(current);
                }
 
-               if (new_nsproxy) {
+               if (new_nsproxy)
                        switch_task_namespaces(current, new_nsproxy);
-                       new_nsproxy = NULL;
-               }
 
                task_lock(current);
 
@@ -1888,9 +1892,6 @@ SYSCALL_DEFINE1(unshare, unsigned long, unshare_flags)
                }
        }
 
-       if (new_nsproxy)
-               put_nsproxy(new_nsproxy);
-
 bad_unshare_cleanup_cred:
        if (new_cred)
                put_cred(new_cred);
This page took 0.029613 seconds and 5 git commands to generate.