[Devel] [PATCH RH7 4/4] exit: reparent: fix the dead-parent PR_SET_CHILD_SUBREAPER reparenting

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Wed Jun 15 17:54:21 MSK 2022


From: Oleg Nesterov <oleg at redhat.com>

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 <oleg at redhat.com>
Cc: Aaron Tomlin <atomlin at redhat.com>
Cc: "Eric W. Biederman" <ebiederm at xmission.com>
Cc: Kay Sievers <kay at vrfy.org>
Cc: Lennart Poettering <lennart at poettering.net>
Cc: Sterling Alexander <stalexan at redhat.com>
Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>

(cherry picked from commit 8a1296aea4a319b33c3367ff3805835e949a229f)
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 kernel/exit.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index 4ba3a108d449..be276aaecaeb 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -662,7 +662,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);
 		}
 	}
-- 
2.35.3



More information about the Devel mailing list