Skip to content

Commit c92f079

Browse files
committed
io_uring/tctx: mark io_wq as exiting before error path teardown
syzbot reports that it's hitting the below condition for exiting an io_wq context: WARN_ON_ONCE(!test_bit(IO_WQ_BIT_EXIT, &wq->state)) in io_wq_put_and_exit(), which can be triggered with memory allocation fault injection. Ensure that the io_wq is marked as exiting to silence this warning trigger. Reported-by: [email protected] Fixes: 7880174 ("io_uring/tctx: clean up __io_uring_add_tctx_node() error handling") Signed-off-by: Jens Axboe <[email protected]>
1 parent 042ff84 commit c92f079

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

io_uring/tctx.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,10 @@ int __io_uring_add_tctx_node(struct io_ring_ctx *ctx)
171171
}
172172
if (!current->io_uring) {
173173
err_free:
174-
if (tctx->io_wq)
174+
if (tctx->io_wq) {
175+
io_wq_exit_start(tctx->io_wq);
175176
io_wq_put_and_exit(tctx->io_wq);
177+
}
176178
percpu_counter_destroy(&tctx->inflight);
177179
kfree(tctx);
178180
}

0 commit comments

Comments
 (0)