diff mbox series

[1/1] io_uring/region: fix error codes after failed vmap

Message ID 0abac19dbf81c061cffaa9534a2471ed5460ad3e.1731803848.git.asml.silence@gmail.com (mailing list archive)
State New
Headers show
Series [1/1] io_uring/region: fix error codes after failed vmap | expand

Commit Message

Pavel Begunkov Nov. 17, 2024, 12:38 a.m. UTC
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>
---
 io_uring/memmap.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jens Axboe Nov. 17, 2024, 4:01 p.m. UTC | #1
On Sun, 17 Nov 2024 00:38:33 +0000, Pavel Begunkov wrote:
> io_create_region() jumps after a vmap failure without setting the return
> code, it could be 0 or just uninitialised.
> 
> 

Applied, thanks!

[1/1] io_uring/region: fix error codes after failed vmap
      commit: a652958888fb1ada3e4f6b548576c2d2c1b60d66

Best regards,
diff mbox series

Patch

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;