Since "WARN_ON(worker->task)", we can not assume that 'worker->task' will be NULL before set 'current' to it.
So need let 'worker' lock protected too, just like it already lock protected all time in main looping. Signed-off-by: Chen Gang <gang.c...@asianux.com> --- kernel/kthread.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/kernel/kthread.c b/kernel/kthread.c index 760e86d..8d572b8 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c @@ -511,8 +511,10 @@ int kthread_worker_fn(void *worker_ptr) struct kthread_worker *worker = worker_ptr; struct kthread_work *work; + spin_lock_irq(&worker->lock); WARN_ON(worker->task); worker->task = current; + spin_unlock_irq(&worker->lock); repeat: set_current_state(TASK_INTERRUPTIBLE); /* mb paired w/ kthread_stop */ -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/