From: Oleg Nesterov Date: Wed, 10 Dec 2014 23:54:59 +0000 (-0800) Subject: exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting X-Git-Tag: v3.19-rc1~135^2~10 X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=8a1296aea4a319b33c3367ff3805835e949a229f;p=cascardo%2Flinux.git exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting The ->has_child_subreaper code in find_new_reaper() finds alive "thread" but returns another "reaper" thread which can be dead. Signed-off-by: Oleg Nesterov Cc: Aaron Tomlin Cc: "Eric W. Biederman" Cc: Kay Sievers Cc: Lennart Poettering Cc: Sterling Alexander Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/exit.c b/kernel/exit.c index 9a65f10dc9ff..fd38a8f04367 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -512,7 +512,7 @@ static struct task_struct *find_new_reaper(struct task_struct *father) thread = reaper; do { if (!(thread->flags & PF_EXITING)) - return reaper; + return thread; } while_each_thread(reaper, thread); } }