[PATCH 6.18 136/175] io_uring/zcrx: fix page array leak

Greg Kroah-Hartman
2026-02-09T14:32:37Z

From: Pavel Begunkov <asml.silence@gmail.com>

[ Upstream commit 0ae91d8ab70922fb74c22c20bedcb69459579b1c ]

d9f595b9a65e ("io_uring/zcrx: fix leaking pages on sg init fail") fixed
a page leakage but didn't free the page array, release it as well.

Fixes: b84621d96ee02 ("io_uring/zcrx: allocate sgtable for umem areas")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
io_uring/zcrx.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 875ad40cf6591..03396769c775d 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -196,6 +196,7 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
GFP_KERNEL_ACCOUNT);
if (ret) {
unpin_user_pages(pages, nr_pages);
+ kvfree(pages);
return ret;
}

--
2.51.0