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,
ret = eligible_child(pid, options, p);
if (!ret)
continue;
flag = 1;
switch (p->state) {
case TASK_TRACED:
flag = 1;
if (!my_ptrace_child(p))
continue;
/*FALLTHROUGH*/
case TASK_STOPPED:
flag = 1;
if (!(options & WUNTRACED) &&
!my_ptrace_child(p))
continue;
......@@ -1377,6 +1378,7 @@ static long do_wait(pid_t pid, int options, struct siginfo __user *infop,
goto end;
break;
}
flag = 1;
check_continued:
if (!unlikely(options & WCONTINUED))
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