aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/exit.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index decf648574f6..e354cbb13a9b 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -560,9 +560,6 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
560 struct list_head *dead) 560 struct list_head *dead)
561{ 561{
562 list_move_tail(&p->sibling, &p->real_parent->children); 562 list_move_tail(&p->sibling, &p->real_parent->children);
563
564 if (p->exit_state == EXIT_DEAD)
565 return;
566 /* 563 /*
567 * If this is a threaded reparent there is no need to 564 * If this is a threaded reparent there is no need to
568 * notify anyone anything has happened. 565 * notify anyone anything has happened.
@@ -570,9 +567,19 @@ static void reparent_leader(struct task_struct *father, struct task_struct *p,
570 if (same_thread_group(p->real_parent, father)) 567 if (same_thread_group(p->real_parent, father))
571 return; 568 return;
572 569
573 /* We don't want people slaying init. */ 570 /*
571 * We don't want people slaying init.
572 *
573 * Note: we do this even if it is EXIT_DEAD, wait_task_zombie()
574 * can change ->exit_state to EXIT_ZOMBIE. If this is the final
575 * state, do_notify_parent() was already called and ->exit_signal
576 * doesn't matter.
577 */
574 p->exit_signal = SIGCHLD; 578 p->exit_signal = SIGCHLD;
575 579
580 if (p->exit_state == EXIT_DEAD)
581 return;
582
576 /* If it has exited notify the new parent about this child's death. */ 583 /* If it has exited notify the new parent about this child's death. */
577 if (!p->ptrace && 584 if (!p->ptrace &&
578 p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) { 585 p->exit_state == EXIT_ZOMBIE && thread_group_empty(p)) {