From: Lai Jiangshan Date: Tue, 3 Jun 2014 07:33:08 +0000 (+0800) Subject: workqueue: sanity check pool->cpu in wq_worker_sleeping() X-Git-Tag: v3.17-rc1~149^2~14 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=92b69f509196fc5afc6a357511b864d372f42419;p=karo-tx-linux.git workqueue: sanity check pool->cpu in wq_worker_sleeping() 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 Signed-off-by: Tejun Heo --- diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 4f8d72dae0e8..8474e5752f1f 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -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; /*