mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
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 <asml.silence@gmail.com> Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
committed by
Jens Axboe
parent
0c89dbbcad
commit
6e9752977c
@@ -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);
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user