Now that EXIT_DEAD is the terminal state it doesn't make sense
to call eligible_child() or security_task_wait() if the task is
really dead.

Tested-by: Michal Schmidt <[email protected]>
Signed-off-by: Oleg Nesterov <[email protected]>
---
 kernel/exit.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/exit.c b/kernel/exit.c
index aaad08d..3d6f247 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1331,7 +1331,12 @@ static int wait_task_continued(struct wait_opts *wo, 
struct task_struct *p)
 static int wait_consider_task(struct wait_opts *wo, int ptrace,
                                struct task_struct *p)
 {
-       int ret = eligible_child(wo, p);
+       int ret;
+
+       if (unlikely(p->exit_state == EXIT_DEAD))
+               return 0;
+
+       ret = eligible_child(wo, p);
        if (!ret)
                return ret;
 
@@ -1349,10 +1354,6 @@ static int wait_consider_task(struct wait_opts *wo, int 
ptrace,
                return 0;
        }
 
-       /* dead body doesn't have much to contribute */
-       if (unlikely(p->exit_state == EXIT_DEAD))
-               return 0;
-
        if (unlikely(p->exit_state == EXIT_TRACE)) {
                /*
                 * ptrace == 0 means we are the natural parent. In this case
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to