From: Pavel Begunkov Date: Thu, 16 Oct 2025 13:23:21 +0000 (+0100) Subject: io_uring: don't free never created regions X-Git-Url: https://gentwo.org/gitweb/?a=commitdiff_plain;h=6e9752977caa47c200f88d7df1ff114955a03bad;p=linux%2F.git io_uring: don't free never created regions 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 Reviewed-by: Gabriel Krisman Bertazi Signed-off-by: Jens Axboe --- diff --git a/io_uring/register.c b/io_uring/register.c index f7f71f035b0d..b11550ed940c 100644 --- a/io_uring/register.c +++ b/io_uring/register.c @@ -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); /*