]> Gentwo Git Trees - linux/.git/commitdiff
io_uring: don't free never created regions
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 16 Oct 2025 13:23:21 +0000 (14:23 +0100)
committerJens Axboe <axboe@kernel.dk>
Mon, 20 Oct 2025 16:37:56 +0000 (10:37 -0600)
io_free_region() tolerates empty regions but there is no reason to that
either. If the first io_create_region() in io_register_resize_rings()
fails, just return the error without attempting to clean it up.

Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/register.c

index f7f71f035b0dc8244b2aab471043db078b291c51..b11550ed940c974fbc9448ad1782290132f44207 100644 (file)
@@ -432,10 +432,9 @@ static int io_register_resize_rings(struct io_ring_ctx *ctx, void __user *arg)
                rd.flags |= IORING_MEM_REGION_TYPE_USER;
        }
        ret = io_create_region(ctx, &n.ring_region, &rd, IORING_OFF_CQ_RING);
-       if (ret) {
-               io_register_free_rings(ctx, &n);
+       if (ret)
                return ret;
-       }
+
        n.rings = io_region_get_ptr(&n.ring_region);
 
        /*