[PATCH 3/3] workqueue: BUG_ON() instead of returning NULL in wq_node_nr_active()

From: Breno Leitao

Date: Wed Aug 12 2026 - 12:18:10 EST


wq_node_nr_active() warns and returns NULL when @wq is not unbound, but
every caller dereferences the result right away, so the WARN_ON_ONCE()
only moves the oops one frame up, as raised by Tejun.

Fix it by BUGing_ON() instead of this silly WARN_ON_ONCE();

Fixes: b72fdc651056 ("workqueue: account nr_active by the backing pool")
Suggested-by: Tejun Heo <tj@xxxxxxxxxx>
Signed-off-by: Breno Leitao <leitao@xxxxxxxxxx>
---
kernel/workqueue.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 83aced28523b5..cbc416147dcaa 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -1625,8 +1625,7 @@ static bool is_percpu_pool(struct worker_pool *pool)
static struct wq_node_nr_active *wq_node_nr_active(struct workqueue_struct *wq,
int node)
{
- if (WARN_ON_ONCE(!(wq->flags & WQ_UNBOUND)))
- return NULL;
+ BUG_ON(!(wq->flags & WQ_UNBOUND));

if (node == NUMA_NO_NODE)
node = nr_node_ids;

--
2.53.0-Meta