Merge branch 'for-linus-2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[platform/adaptation/renesas_rcar/renesas_kernel.git] / kernel / fork.c
index 0560781..ff1cad3 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);
@@ -619,14 +624,6 @@ void mmput(struct mm_struct *mm)
                        module_put(mm->binfmt->module);
                mmdrop(mm);
        }
-
-       /*
-        * Final rss-counter synchronization. After this point there must be
-        * no pagefaults into this mm from the current context.  Otherwise
-        * mm->rss_stat will be inconsistent.
-        */
-       if (mm)
-               sync_mm_rss(mm);
 }
 EXPORT_SYMBOL_GPL(mmput);
 
@@ -1423,7 +1420,7 @@ static struct task_struct *copy_process(unsigned long clone_flags,
         */
        p->group_leader = p;
        INIT_LIST_HEAD(&p->thread_group);
-       INIT_HLIST_HEAD(&p->task_works);
+       p->task_works = NULL;
 
        /* Now that the task is set up, run cgroup callbacks if
         * necessary. We need to run them before the task is visible