aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/fork.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/fork.c')
-rw-r--r--kernel/fork.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c
index d681f8f10d2d..b7cdea10239c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1553,6 +1553,18 @@ static __latent_entropy struct task_struct *copy_process(
1553 if (!p) 1553 if (!p)
1554 goto fork_out; 1554 goto fork_out;
1555 1555
1556 /*
1557 * This _must_ happen before we call free_task(), i.e. before we jump
1558 * to any of the bad_fork_* labels. This is to avoid freeing
1559 * p->set_child_tid which is (ab)used as a kthread's data pointer for
1560 * kernel threads (PF_KTHREAD).
1561 */
1562 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1563 /*
1564 * Clear TID on mm_release()?
1565 */
1566 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1567
1556 ftrace_graph_init_task(p); 1568 ftrace_graph_init_task(p);
1557 1569
1558 rt_mutex_init_task(p); 1570 rt_mutex_init_task(p);
@@ -1716,11 +1728,6 @@ static __latent_entropy struct task_struct *copy_process(
1716 } 1728 }
1717 } 1729 }
1718 1730
1719 p->set_child_tid = (clone_flags & CLONE_CHILD_SETTID) ? child_tidptr : NULL;
1720 /*
1721 * Clear TID on mm_release()?
1722 */
1723 p->clear_child_tid = (clone_flags & CLONE_CHILD_CLEARTID) ? child_tidptr : NULL;
1724#ifdef CONFIG_BLOCK 1731#ifdef CONFIG_BLOCK
1725 p->plug = NULL; 1732 p->plug = NULL;
1726#endif 1733#endif