pidfd: don't do_notify_pidfd() if !thread_group_empty()
[linux-2.6-block.git] / kernel / signal.c
index c9c57d053ce4f64d9a832f358b4e1ee837959b8b..9561a3962ca6878f80ee1f46feb4e1846517c1d0 100644 (file)
@@ -2050,9 +2050,11 @@ bool do_notify_parent(struct task_struct *tsk, int sig)
 
        WARN_ON_ONCE(!tsk->ptrace &&
               (tsk->group_leader != tsk || !thread_group_empty(tsk)));
-
-       /* Wake up all pidfd waiters */
-       do_notify_pidfd(tsk);
+       /*
+        * tsk is a group leader and has no threads, wake up the pidfd waiters.
+        */
+       if (thread_group_empty(tsk))
+               do_notify_pidfd(tsk);
 
        if (sig != SIGCHLD) {
                /*