Skip to content

Commit 77f300b

Browse files
daeseokyounhtejun
authored andcommitted
workqueue: fix bugs in wq_update_unbound_numa() failure path
wq_update_unbound_numa() failure path has the following two bugs. - alloc_unbound_pwq() is called without holding wq->mutex; however, if the allocation fails, it jumps to out_unlock which tries to unlock wq->mutex. - The function should switch to dfl_pwq on failure but didn't do so after alloc_unbound_pwq() failure. Fix it by regrabbing wq->mutex and jumping to use_dfl_pwq on alloc_unbound_pwq() failure. Signed-off-by: Daeseok Youn <[email protected]> Acked-by: Lai Jiangshan <[email protected]> Signed-off-by: Tejun Heo <[email protected]> Cc: [email protected] Fixes: 4c16bd3 ("workqueue: implement NUMA affinity for unbound workqueues")
1 parent c9eaa44 commit 77f300b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/workqueue.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4100,7 +4100,8 @@ static void wq_update_unbound_numa(struct workqueue_struct *wq, int cpu,
41004100
if (!pwq) {
41014101
pr_warning("workqueue: allocation failed while updating NUMA affinity of \"%s\"\n",
41024102
wq->name);
4103-
goto out_unlock;
4103+
mutex_lock(&wq->mutex);
4104+
goto use_dfl_pwq;
41044105
}
41054106

41064107
/*

0 commit comments

Comments
 (0)