From: Linus Torvalds Date: Sat, 1 Oct 2005 18:04:18 +0000 (-0700) Subject: Fix inequality comparison against "task->state" X-Git-Tag: v2.6.14-rc4~92 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14bf01bb0599c89fc7f426d20353b76e12555308;p=linux-2.6 Fix inequality comparison against "task->state" We should always use bitmask ops, rather than depend on some ordering of the different states. With the TASK_NONINTERACTIVE flag, the inequality doesn't really work. Oleg Nesterov argues (likely correctly) that this test is unnecessary in the first place. However, the minimal fix for now is to at least make it work in the presense of TASK_NONINTERACTIVE. Waiting for consensus from Roland & co on potential bigger cleanups. Signed-off-by: Linus Torvalds --- diff --git a/kernel/exit.c b/kernel/exit.c index ee6d8b8abe..4307773261 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -1203,7 +1203,7 @@ static int wait_task_stopped(task_t *p, int delayed_group_leader, int noreap, exit_code = p->exit_code; if (unlikely(!exit_code) || - unlikely(p->state > TASK_STOPPED)) + unlikely(p->state & TASK_TRACED)) goto bail_ref; return wait_noreap_copyout(p, pid, uid, why, (exit_code << 8) | 0x7f,