Skip to content

Commit 32830e9

Browse files
isilencegregkh
authored andcommitted
io_uring/zcrx: don't leak pages on account failure
commit 6bbd341 upstream. 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: 262ab20 ("io_uring/zcrx: account area memory") Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/e19f283a912f200c0d427e376cb789fc3f3d69bc.1753091564.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e004d86 commit 32830e9

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

io_uring/zcrx.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,13 @@ static int io_import_umem(struct io_zcrx_ifq *ifq,
187187

188188
mem->account_pages = io_count_account_pages(pages, nr_pages);
189189
ret = io_account_mem(ifq->ctx, mem->account_pages);
190-
if (ret < 0) {
190+
if (ret < 0)
191191
mem->account_pages = 0;
192-
return ret;
193-
}
194192

195193
mem->pages = pages;
196194
mem->nr_folios = nr_pages;
197195
mem->size = area_reg->len;
198-
return 0;
196+
return ret;
199197
}
200198

201199
static void io_release_area_mem(struct io_zcrx_mem *mem)

0 commit comments

Comments
 (0)