Commit 02255d55 authored by Pavel Begunkov's avatar Pavel Begunkov Committed by Jens Axboe
Browse files

io_uring: pass ctx to io_register_free_rings



A preparation patch, pass the context to io_register_free_rings.

Signed-off-by: default avatarPavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/c1865fd2b3d4db22d1a1aac7dd06ea22cb990834.1732886067.git.asml.silence@gmail.com


Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 087f9978
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -375,7 +375,8 @@ struct io_ring_ctx_rings {
	struct io_rings *rings;
};

static void io_register_free_rings(struct io_uring_params *p,
static void io_register_free_rings(struct io_ring_ctx *ctx,
				   struct io_uring_params *p,
				   struct io_ring_ctx_rings *r)
{
	if (!(p->flags & IORING_SETUP_NO_MMAP)) {
@@ -455,7 +456,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
	n.rings->cq_ring_entries = p.cq_entries;

	if (copy_to_user(arg, &p, sizeof(p))) {
		io_register_free_rings(&p, &n);
		io_register_free_rings(ctx, &p, &n);
		return -EFAULT;
	}

@@ -464,7 +465,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
	else
		size = array_size(sizeof(struct io_uring_sqe), p.sq_entries);
	if (size == SIZE_MAX) {
		io_register_free_rings(&p, &n);
		io_register_free_rings(ctx, &p, &n);
		return -EOVERFLOW;
	}

@@ -475,7 +476,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
					p.sq_off.user_addr,
					size);
	if (IS_ERR(ptr)) {
		io_register_free_rings(&p, &n);
		io_register_free_rings(ctx, &p, &n);
		return PTR_ERR(ptr);
	}

@@ -565,7 +566,7 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
out:
	spin_unlock(&ctx->completion_lock);
	mutex_unlock(&ctx->mmap_lock);
	io_register_free_rings(&p, to_free);
	io_register_free_rings(ctx, &p, to_free);

	if (ctx->sq_data)
		io_sq_thread_unpark(ctx->sq_data);