io_uring/region: fix error codes after failed vmap

io_create_region() jumps after a vmap failure without setting the return
code, it could be 0 or just uninitialised.

Fixes: dfbbfbf191 ("io_uring: introduce concept of memory regions")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/0abac19dbf81c061cffaa9534a2471ed5460ad3e.1731803848.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Pavel Begunkov 2024-11-17 00:38:33 +00:00 committed by Jens Axboe
parent d617b3147d
commit a652958888

View File

@ -247,8 +247,10 @@ int io_create_region(struct io_ring_ctx *ctx, struct io_mapped_region *mr,
}
vptr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
if (!vptr)
if (!vptr) {
ret = -ENOMEM;
goto out_free;
}
mr->pages = pages;
mr->vmap_ptr = vptr;