]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
io_uring/tctx: check for setup tctx->io_wq before teardown
authorJens Axboe <axboe@kernel.dk>
Wed, 15 Apr 2026 20:22:16 +0000 (14:22 -0600)
committerJens Axboe <axboe@kernel.dk>
Mon, 20 Apr 2026 20:47:29 +0000 (14:47 -0600)
As with the idling code before it, the error exit path should check for
a NULL tctx->io_wq before calling io_wq_put_and_exit().

Fixes: 7880174e1e5e ("io_uring/tctx: clean up __io_uring_add_tctx_node() error handling")
Reported-by: Dan Carpenter <error27@gmail.com>
Reviewed-by: Clément Léger <cleger@meta.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/tctx.c

index 61533f30494f5a040813206acf3158c047667316..c011a593c0ad875b0a64c9ca5de797617c74e1a3 100644 (file)
@@ -171,7 +171,8 @@ int __io_uring_add_tctx_node(struct io_ring_ctx *ctx)
        }
        if (!current->io_uring) {
 err_free:
-               io_wq_put_and_exit(tctx->io_wq);
+               if (tctx->io_wq)
+                       io_wq_put_and_exit(tctx->io_wq);
                percpu_counter_destroy(&tctx->inflight);
                kfree(tctx);
        }