* [PATCH 5.10/5.15/6.1/6.6] io_uring/io-wq: save worker type before dropping its reference
@ 2026-11-24 10:35 Alexander Martyniuk
2026-11-24 13:25 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Martyniuk @ 2026-11-24 10:35 UTC (permalink / raw)
To: stable, Greg Kroah-Hartman
Cc: Alexander Martyniuk, Jens Axboe, linux-kernel, lvc-project, Kyle Zeng
From: Kyle Zeng <kylebot@openai.com>
commit 37e425460b7c41687e51e3254b1eb1d799da9614 upstream.
io_wq_cancel_tw_create() inspects cb->func after calling
io_worker_cancel_cb(). For an existing worker, that call can drop the
last worker reference and wake io_worker_exit(). If the canceling task
is preempted, the worker can be unlinked and freed by kfree_rcu() before
the callback function is inspected. KASAN reports a slab-use-after-free
read in this path.
Save whether the callback belongs to an unpublished continuation worker
while its reference is still held, then use the saved result for the
conditional free. This preserves the existing accounting and frees only
the worker allocated for the canceled continuation.
Fixes: e6db6f9398da ("io_uring/io-wq: only free worker if it was allocated for creation")
Cc: stable@vger.kernel.org
Signed-off-by: Kyle Zeng <kylebot@openai.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Alexander Martyniuk <alexevgmart@gmail.com>
---
Backport fix for CVE-2026-99804
io_uring/io-wq.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/io_uring/io-wq.c b/io_uring/io-wq.c
index f57743d911b4..2692f5ef387f 100644
--- a/io_uring/io-wq.c
+++ b/io_uring/io-wq.c
@@ -1232,14 +1232,16 @@ static void io_wq_cancel_tw_create(struct io_wq *wq)
while ((cb = task_work_cancel_match(wq->task, io_task_work_match, wq)) != NULL) {
struct io_worker *worker;
+ bool free_worker;
worker = container_of(cb, struct io_worker, create_work);
- io_worker_cancel_cb(worker);
/*
* Only the worker continuation helper has worker allocated and
- * hence needs freeing.
+ * hence needs freeing. Save this before dropping its reference.
*/
- if (cb->func == create_worker_cont)
+ free_worker = cb->func == create_worker_cont;
+ io_worker_cancel_cb(worker);
+ if (free_worker)
kfree(worker);
}
}
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH 5.10/5.15/6.1/6.6] io_uring/io-wq: save worker type before dropping its reference
2026-11-24 10:35 [PATCH 5.10/5.15/6.1/6.6] io_uring/io-wq: save worker type before dropping its reference Alexander Martyniuk
@ 2026-11-24 13:25 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2026-11-24 13:25 UTC (permalink / raw)
To: Alexander Martyniuk, stable, Greg Kroah-Hartman
Cc: linux-kernel, lvc-project, Kyle Zeng
On 11/24/26 3:35 AM, Alexander Martyniuk wrote:
> From: Kyle Zeng <kylebot@openai.com>
>
> commit 37e425460b7c41687e51e3254b1eb1d799da9614 upstream.
Not sure why you're sending this, it's already in stable?
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-24 13:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 10:35 [PATCH 5.10/5.15/6.1/6.6] io_uring/io-wq: save worker type before dropping its reference Alexander Martyniuk
2026-11-24 13:25 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®