]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
workqueue: sanity check pool->cpu in wq_worker_sleeping()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 3 Jun 2014 07:33:08 +0000 (15:33 +0800)
committerTejun Heo <tj@kernel.org>
Thu, 19 Jun 2014 16:32:27 +0000 (12:32 -0400)
In theory, pool->cpu is equals to @cpu in wq_worker_sleeping() after
worker->flags is checked.

And "pool->cpu != cpu" sanity check will help us if something wrong.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/workqueue.c

index 4f8d72dae0e8786223a2d275f3c73cf6b0585e3b..8474e5752f1f8df25d30b9a95712bd55a2caeb73 100644 (file)
@@ -843,7 +843,7 @@ struct task_struct *wq_worker_sleeping(struct task_struct *task, int cpu)
        pool = worker->pool;
 
        /* this can only happen on the local cpu */
-       if (WARN_ON_ONCE(cpu != raw_smp_processor_id()))
+       if (WARN_ON_ONCE(cpu != raw_smp_processor_id() || pool->cpu != cpu))
                return NULL;
 
        /*