diff mbox series

[1/1] io_uring/zcrx: recheck ifq on shutdown

Message ID 905e55c47235ab26377a735294f939f31d00ae53.1739934175.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [1/1] io_uring/zcrx: recheck ifq on shutdown | expand

Commit Message

Pavel Begunkov Feb. 19, 2025, 10:08 a.m. UTC
io_ring_exit_work() checks ifq before shutting it down and guarantees
that the pointer is stable, but instead of relying on rather complicated
synchronisation recheck the ifq pointer inside.

Reported-by: Kees Bakker <kees@ijzerbout.nl>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/zcrx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Jens Axboe Feb. 19, 2025, 3:07 p.m. UTC | #1
On Wed, 19 Feb 2025 10:08:01 +0000, Pavel Begunkov wrote:
> io_ring_exit_work() checks ifq before shutting it down and guarantees
> that the pointer is stable, but instead of relying on rather complicated
> synchronisation recheck the ifq pointer inside.
> 
> 

Applied, thanks!

[1/1] io_uring/zcrx: recheck ifq on shutdown
      commit: bc674a04c47cc23ad7e12893cad6226ea8f7a8ec

Best regards,
diff mbox series

Patch

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 026efb8dd381..a9eaab3fccf2 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -489,9 +489,9 @@  void io_shutdown_zcrx_ifqs(struct io_ring_ctx *ctx)
 {
 	lockdep_assert_held(&ctx->uring_lock);
 
-	if (ctx->ifq)
-		io_zcrx_scrub(ctx->ifq);
-
+	if (!ctx->ifq)
+		return;
+	io_zcrx_scrub(ctx->ifq);
 	io_close_queue(ctx->ifq);
 }