From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com
Subject: [PATCH 1/4] io_uring/rsrc: avoid assigning buf table on failure
Date: Fri, 4 Apr 2025 17:22:14 +0100 [thread overview]
Message-ID: <668bcc8f0590e9b8b8a51599a5832b48e387e396.1743783348.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1743783348.git.asml.silence@gmail.com>
The fail path of io_sqe_buffers_register() assigns ->buf_table just to
implicitly pass it into io_sqe_buffers_unregister(). Be more explicit
by using io_rsrc_data_free() for destruction and passing the table to it
directly.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/rsrc.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index b36c8825550e..3c6e6e396052 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -914,11 +914,12 @@ int io_sqe_buffers_register(struct io_ring_ctx *ctx, void __user *arg,
data.nodes[i] = node;
}
- ctx->buf_table = data;
if (ret) {
- io_clear_table_tags(&ctx->buf_table);
- io_sqe_buffers_unregister(ctx);
+ io_clear_table_tags(&data);
+ io_rsrc_data_free(ctx, &data);
+ return ret;
}
+ ctx->buf_table = data;
return ret;
}
--
2.48.1
next prev parent reply other threads:[~2025-04-04 16:21 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 16:22 [PATCH 0/4] buffer table registration cleanup Pavel Begunkov
2025-04-04 16:22 ` Pavel Begunkov [this message]
2025-04-04 16:22 ` [PATCH 2/4] io_uring: deduplicate node tagging Pavel Begunkov
2025-04-04 16:22 ` [PATCH 3/4] io_uring: early return for sparse buf table registration Pavel Begunkov
2025-04-04 16:22 ` [PATCH 4/4] io_uring: reuse buffer updates for registration Pavel Begunkov
2025-04-04 16:38 ` Jens Axboe
2025-04-04 21:38 ` Pavel Begunkov
2025-04-04 22:00 ` Jens Axboe
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=668bcc8f0590e9b8b8a51599a5832b48e387e396.1743783348.git.asml.silence@gmail.com \
--to=asml.silence@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