Messages in this thread | | | Date | Thu, 19 Jun 2014 12:32:09 -0400 | From | Tejun Heo <> | Subject | Re: [PATCH] workqueue: sanity check pool->cpu in wq_worker_sleeping() |
| |
On Tue, Jun 03, 2014 at 03:33:08PM +0800, Lai Jiangshan wrote: > 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> > --- > kernel/workqueue.c | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/kernel/workqueue.c b/kernel/workqueue.c > index 9f53abd..61381a2 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))
Hmmm... yeah, this can catch work functions hijacking and binding per-cpu worker to another cpu.
Applied to wq/for-3.17.
Thanks.
-- tejun
| |