Commit 607acf00 authored by Dinakar Guniguntala's avatar Dinakar Guniguntala Committed by Linus Torvalds

[PATCH] Fix do_wait race

Only set the flag in the cases when the exit state is not either
TASK_DEAD or TASK_ZOMBIE.

(TASK_DEAD or TASK_ZOMBIE will either race or we'll return the 
information, so no need to note them).

I confirmed that this fixes the problem and I also ran some LTP tests
Signed-off-by: default avatarDinakar Guniguntala <dino@in.ibm.com>
Signed-off-by: default avatarSripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d9621fa0
...@@ -1335,14 +1335,15 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop, ...@@ -1335,14 +1335,15 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
ret = eligible_child(pid, options, p); ret = eligible_child(pid, options, p);
if (!ret) if (!ret)
continue; continue;
flag = 1;
switch (p->state) { switch (p->state) {
case TASK_TRACED: case TASK_TRACED:
flag = 1;
if (!my_ptrace_child(p)) if (!my_ptrace_child(p))
continue; continue;
/*FALLTHROUGH*/ /*FALLTHROUGH*/
case TASK_STOPPED: case TASK_STOPPED:
flag = 1;
if (!(options & WUNTRACED) && if (!(options & WUNTRACED) &&
!my_ptrace_child(p)) !my_ptrace_child(p))
continue; continue;
...@@ -1377,6 +1378,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop, ...@@ -1377,6 +1378,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
goto end; goto end;
break; break;
} }
flag = 1;
check_continued: check_continued:
if (!unlikely(options & WCONTINUED)) if (!unlikely(options & WCONTINUED))
continue; continue;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment