revert "sched: Fix fork() error path to not crash"
authorAndrew Morton <akpm@linux-foundation.org>
Mon, 30 Jul 2012 21:42:31 +0000 (14:42 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 31 Jul 2012 00:25:20 +0000 (17:25 -0700)
To make way for "fork: fix error handling in dup_task()", which fixes the
errors more completely.

Cc: Salman Qazi <sqazi@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/fork.c

index 2c1802948a38034598459e8d9b8cfeb533095679..088025bd1925d9917f1efe3f8fb49c484601013b 100644 (file)
@@ -304,17 +304,12 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
        }
 
        err = arch_dup_task_struct(tsk, orig);
-
-       /*
-        * We defer looking at err, because we will need this setup
-        * for the clean up path to work correctly.
-        */
-       tsk->stack = ti;
-       setup_thread_stack(tsk, orig);
-
        if (err)
                goto out;
 
+       tsk->stack = ti;
+
+       setup_thread_stack(tsk, orig);
        clear_user_return_notifier(tsk);
        clear_tsk_need_resched(tsk);
        stackend = end_of_stack(tsk);