From: Jens Axboe <axboe@kernel.dk>
To: io-uring@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, Dan Carpenter <error27@gmail.com>
Subject: [PATCH 1/2] io_uring/tctx: check for setup tctx->io_wq before teardown
Date: Thu, 16 Apr 2026 14:05:52 -0600 [thread overview]
Message-ID: <20260416200622.831635-2-axboe@kernel.dk> (raw)
In-Reply-To: <20260416200622.831635-1-axboe@kernel.dk>
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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
---
io_uring/tctx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/io_uring/tctx.c b/io_uring/tctx.c
index 61533f30494f..c011a593c0ad 100644
--- a/io_uring/tctx.c
+++ b/io_uring/tctx.c
@@ -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);
}
--
2.53.0
next prev parent reply other threads:[~2026-04-16 20:06 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-16 20:05 [PATCH 0/2] Misc minor tctx fixes Jens Axboe
2026-04-16 20:05 ` Jens Axboe [this message]
2026-04-20 8:42 ` [PATCH 1/2] io_uring/tctx: check for setup tctx->io_wq before teardown Clément Léger
2026-04-16 20:05 ` [PATCH 2/2] io_uring/tctx: mark io_wq as exiting before error path teardown Jens Axboe
2026-04-20 8:44 ` Clément Léger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260416200622.831635-2-axboe@kernel.dk \
--to=axboe@kernel.dk \
--cc=error27@gmail.com \
--cc=io-uring@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox