aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/exit.c')
-rw-r--r--kernel/exit.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/exit.c b/kernel/exit.c
index b0f482f5daf9..063745699f7f 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -571,6 +571,8 @@ static void forget_original_parent(struct task_struct *father)
571 571
572 /* Can drop and reacquire tasklist_lock */ 572 /* Can drop and reacquire tasklist_lock */
573 reaper = find_child_reaper(father); 573 reaper = find_child_reaper(father);
574 if (list_empty(&father->children))
575 goto unlock;
574 576
575 reaper = find_new_reaper(father, reaper); 577 reaper = find_new_reaper(father, reaper);
576 list_for_each_entry(p, &father->children, sibling) { 578 list_for_each_entry(p, &father->children, sibling) {
@@ -591,6 +593,7 @@ static void forget_original_parent(struct task_struct *father)
591 reparent_leader(father, p, &dead_children); 593 reparent_leader(father, p, &dead_children);
592 } 594 }
593 list_splice_tail_init(&father->children, &reaper->children); 595 list_splice_tail_init(&father->children, &reaper->children);
596 unlock:
594 write_unlock_irq(&tasklist_lock); 597 write_unlock_irq(&tasklist_lock);
595 598
596 list_for_each_entry_safe(p, n, &dead_children, ptrace_entry) { 599 list_for_each_entry_safe(p, n, &dead_children, ptrace_entry) {