]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring: fix unexpected placement on same size resizing
authorPavel Begunkov <asml.silence@gmail.com>
Wed, 15 Oct 2025 12:10:31 +0000 (13:10 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 24 Nov 2025 09:37:26 +0000 (10:37 +0100)
[ Upstream commit 437c23357d897f5b5b7d297c477da44b56654d46 ]

There might be many reasons why a user is resizing a ring, e.g. moving
to huge pages or for some memory compaction using IORING_SETUP_NO_MMAP.
Don't bypass resizing, the user will definitely be surprised seeing 0
while the rings weren't actually moved to a new place.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
io_uring/register.c

index b1772a470bf6e5de4a72b968176effbe74ffcb6e..dacbe8596b5c23b45e0fb82a29d40051e70a2344 100644 (file)
@@ -426,13 +426,6 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
        if (unlikely(ret))
                return ret;
 
-       /* nothing to do, but copy params back */
-       if (p.sq_entries == ctx->sq_entries && p.cq_entries == ctx->cq_entries) {
-               if (copy_to_user(arg, &p, sizeof(p)))
-                       return -EFAULT;
-               return 0;
-       }
-
        size = rings_size(p.flags, p.sq_entries, p.cq_entries,
                                &sq_array_offset);
        if (size == SIZE_MAX)