From: Oleg Nesterov <oleg@tv-sign.ru>
Date: Wed, 17 Oct 2007 06:26:58 +0000 (-0700)
Subject: exit_notify: don't take tasklist for TIF_SIGPENDING re-targeting
X-Git-Tag: firefly_0821_release~25323
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3ae4cbadf4bf97ee137b921a1b928d2a5dcd26ca;p=firefly-linux-kernel-4.4.55.git

exit_notify: don't take tasklist for TIF_SIGPENDING re-targeting

->siglock provides enough protection to iterate over the thread group.

Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Acked-by: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
---

diff --git a/kernel/exit.c b/kernel/exit.c
index b4d569675d4b..28144b94e55c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -747,13 +747,11 @@ static void exit_notify(struct task_struct *tsk)
 		 * Now we'll wake all the threads in the group just to make
 		 * sure someone gets all the pending signals.
 		 */
-		read_lock(&tasklist_lock);
 		spin_lock_irq(&tsk->sighand->siglock);
 		for (t = next_thread(tsk); t != tsk; t = next_thread(t))
 			if (!signal_pending(t) && !(t->flags & PF_EXITING))
 				recalc_sigpending_and_wake(t);
 		spin_unlock_irq(&tsk->sighand->siglock);
-		read_unlock(&tasklist_lock);
 	}
 
 	write_lock_irq(&tasklist_lock);
@@ -781,9 +779,8 @@ static void exit_notify(struct task_struct *tsk)
 	 * and we were the only connection outside, so our pgrp
 	 * is about to become orphaned.
 	 */
-	 
 	t = tsk->real_parent;
-	
+
 	pgrp = task_pgrp(tsk);
 	if ((task_pgrp(t) != pgrp) &&
 	    (task_session(t) == task_session(tsk)) &&