From: Oleg Nesterov Date: Wed, 17 Jun 2009 23:27:42 +0000 (-0700) Subject: do_wait: fix the theoretical race with stop/trace/cont X-Git-Tag: v2.6.31-rc1~206 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f95d39d10fe7d47336e65172f52bf64e0096f983;p=pandora-kernel.git do_wait: fix the theoretical race with stop/trace/cont do_wait: current->state = TASK_INTERRUPTIBLE; read_lock(&tasklist_lock); ... search for the task to reap ... In theory, the ->state changing can leak into the critical section. Since the child can change its status under read_lock(tasklist) in parallel (finish_stop/ptrace_stop), we can miss the wakeup if __wake_up_parent() sees us in TASK_RUNNING state. Add the barrier. Also, use __set_current_state() to set TASK_RUNNING. Signed-off-by: Oleg Nesterov Cc: Ingo Molnar Acked-by: Roland McGrath Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- Reading git-diff-tree failed