]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
io_uring/region: fix error codes after failed vmap
authorPavel Begunkov <asml.silence@gmail.com>
Sun, 17 Nov 2024 00:38:33 +0000 (00:38 +0000)
committerJens Axboe <axboe@kernel.dk>
Sun, 17 Nov 2024 16:01:35 +0000 (09:01 -0700)
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>
io_uring/memmap.c

index bbd9569a01209f8263d04a4a3804591a38ebb04e..6e6ee79ba94fcd97a57811a4bf98fd3a0abf0bdb 100644 (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;