summaryrefslogtreecommitdiff
path: root/io_uring
diff options
context:
space:
mode:
authorPavel Begunkov <asml.silence@gmail.com>2024-11-17 00:38:33 +0000
committerJens Axboe <axboe@kernel.dk>2024-11-17 09:01:35 -0700
commita652958888fb1ada3e4f6b548576c2d2c1b60d66 (patch)
tree3da5558219a7e8f0efd794a2ef97023fdbb078a8 /io_uring
parentd617b3147d54c42351eac63b5398d4ddf4f4011b (diff)
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: dfbbfbf191878 ("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>
Diffstat (limited to 'io_uring')
-rw-r--r--io_uring/memmap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/io_uring/memmap.c b/io_uring/memmap.c
index bbd9569a0120..6e6ee79ba94f 100644
--- a/io_uring/memmap.c
+++ b/io_uring/memmap.c
@@ -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;