]> Pileus Git - ~andy/linux/blobdiff - kernel/fork.c
Merge branches 'audit', 'delay', 'fixes', 'misc' and 'sta2x11' into for-linus
[~andy/linux] / kernel / fork.c
index ab5211b9e622cf94d07b7bfb4ccfd9bac85e7b79..f00e319d8376289f0273fc1d301f4c1ebb132c86 100644 (file)
@@ -304,12 +304,17 @@ static struct task_struct *dup_task_struct(struct task_struct *orig)
        }
 
        err = arch_dup_task_struct(tsk, orig);
-       if (err)
-               goto out;
 
+       /*
+        * 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;
+
        clear_user_return_notifier(tsk);
        clear_tsk_need_resched(tsk);
        stackend = end_of_stack(tsk);