Skip to content

Commit

Permalink
workqueue: fix is_chained_work() regression
Browse files Browse the repository at this point in the history
c9e7cf2 ("workqueue: move busy_hash from global_cwq to
worker_pool") incorrectly converted is_chained_work() to use
get_gcwq() inside for_each_gcwq_cpu() while removing get_gcwq().

As cwq might not exist for all possible workqueue CPUs, @cwq can be
NULL and the following cwq deferences can lead to oops.

Fix it by using for_each_cwq_cpu() instead, which is the better one to
use anyway as we only need to check pools that the wq is associated
with.

Signed-off-by: Tejun Heo <tj@kernel.org>
  • Loading branch information
Tejun Heo committed Feb 14, 2013
1 parent 8594fad commit 1dd6381
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/workqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,7 +1167,7 @@ static bool is_chained_work(struct workqueue_struct *wq)
unsigned long flags;
unsigned int cpu;

for_each_wq_cpu(cpu) {
for_each_cwq_cpu(cpu, wq) {
struct cpu_workqueue_struct *cwq = get_cwq(cpu, wq);
struct worker_pool *pool = cwq->pool;
struct worker *worker;
Expand Down

0 comments on commit 1dd6381

Please sign in to comment.