summaryrefslogtreecommitdiff
path: root/io_uring/register.c
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2025-11-12 12:45:56 +0000
committerJens Axboe <axboe@kernel.dk>2025-11-13 07:27:34 -0700
commit0f4b537363cb66c78e97bb58c26986af62856356 (patch)
tree4a71d99f705e158c91cc4c6b6d42e0cb59202f6b /io_uring/register.c
parent929dbbb699110c9377da721ed7b44a660bb4ee01 (diff)
io_uring: introduce struct io_ctx_config
There will be more information needed during ctx setup, and instead of passing a handful of pointers around, wrap them all into a new structure. Add a helper for encapsulating all configuration checks and preparation, that's also reused for ring resizing. Note, it indirectly adds a io_uring_sanitise_params() check to ring resizing, which is a good thing. Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'io_uring/register.c')
-rw-r--r--io_uring/register.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/io_uring/register.c b/io_uring/register.c
index b5c2275d5ccc..6b0024c20ce7 100644
--- a/io_uring/register.c
+++ b/io_uring/register.c
@@ -398,13 +398,16 @@ static void io_register_free_rings(struct io_ring_ctx *ctx,
static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
{
+ struct io_ctx_config config;
struct io_uring_region_desc rd;
struct io_ring_ctx_rings o = { }, n = { }, *to_free = NULL;
size_t size, sq_array_offset;
unsigned i, tail, old_head;
- struct io_uring_params __p, *p = &__p;
+ struct io_uring_params *p = &config.p;
int ret;
+ memset(&config, 0, sizeof(config));
+
/* limited to DEFER_TASKRUN for now */
if (!(ctx->flags & IORING_SETUP_DEFER_TASKRUN))
return -EINVAL;
@@ -416,7 +419,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
/* properties that are always inherited */
p->flags |= (ctx->flags & COPY_FLAGS);
- ret = io_uring_fill_params(p);
+ ret = io_prepare_config(&config);
if (unlikely(ret))
return ret;