mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
io_uring/zcrx: don't leak pages on account failure
Someone needs to release pinned pages in io_import_umem() if accounting
fails. Assign them to the area but return an error, the following
io_zcrx_free_area() will clean them up.
Fixes: 262ab20518
("io_uring/zcrx: account area memory")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/e19f283a912f200c0d427e376cb789fc3f3d69bc.1753091564.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
720df2310b
commit
6bbd3411ff
@ -199,15 +199,13 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
|
|||||||
|
|
||||||
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);
|
||||||
if (ret < 0) {
|
if (ret < 0)
|
||||||
mem->account_pages = 0;
|
mem->account_pages = 0;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
mem->pages = pages;
|
mem->pages = pages;
|
||||||
mem->nr_folios = nr_pages;
|
mem->nr_folios = nr_pages;
|
||||||
mem->size = area_reg->len;
|
mem->size = area_reg->len;
|
||||||
return 0;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void io_release_area_mem(struct io_zcrx_mem *mem)
|
static void io_release_area_mem(struct io_zcrx_mem *mem)
|
||||||
|
Loading…
Reference in New Issue
Block a user