mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 03:53:37 +02:00
io_uring/zcrx: fix leaking pages on sg init fail
If sg_alloc_table_from_pages() fails, io_import_umem() returns without
cleaning up pinned pages first. Fix it.
Fixes: b84621d96e ("io_uring/zcrx: allocate sgtable for umem areas")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/9fd94d1bc8c316611eccfec7579799182ff3fb0a.1753091564.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
6bbd3411ff
commit
d9f595b9a6
|
|
@ -194,8 +194,10 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
|
||||||
ret = sg_alloc_table_from_pages(&mem->page_sg_table, pages, nr_pages,
|
ret = sg_alloc_table_from_pages(&mem->page_sg_table, pages, nr_pages,
|
||||||
0, nr_pages << PAGE_SHIFT,
|
0, nr_pages << PAGE_SHIFT,
|
||||||
GFP_KERNEL_ACCOUNT);
|
GFP_KERNEL_ACCOUNT);
|
||||||
if (ret)
|
if (ret) {
|
||||||
|
unpin_user_pages(pages, nr_pages);
|
||||||
return ret;
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
mem->account_pages = io_count_account_pages(pages, nr_pages);
|
mem->account_pages = io_count_account_pages(pages, nr_pages);
|
||||||
ret = io_account_mem(ifq->ctx, mem->account_pages);
|
ret = io_account_mem(ifq->ctx, mem->account_pages);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user