do_wait: fix the theoretical race with stop/trace/cont
[linux-2.6-block.git] / kernel / exit.c
index dd83c841910121131a443afd3673a52b000917c0..7ef355dd3dca517ae74eaadf54f8ed50f7883290 100644 (file)
@@ -1581,7 +1581,7 @@ repeat:
           (!wo->wo_pid || hlist_empty(&wo->wo_pid->tasks[wo->wo_type])))
                goto notask;
 
-       current->state = TASK_INTERRUPTIBLE;
+       set_current_state(TASK_INTERRUPTIBLE);
        read_lock(&tasklist_lock);
        tsk = current;
        do {
@@ -1608,7 +1608,7 @@ notask:
                }
        }
 end:
-       current->state = TASK_RUNNING;
+       __set_current_state(TASK_RUNNING);
        remove_wait_queue(&current->signal->wait_chldexit,&wait);
        if (wo->wo_info) {
                struct siginfo __user *infop = wo->wo_info;