Skip to content

Commit 216e583

Browse files
isilenceaxboe
authored andcommitted
io_uring: fix misaccounting fix buf pinned pages
As Andres reports "... io_sqe_buffer_register() doesn't initialize imu. io_buffer_account_pin() does imu->acct_pages++, before calling io_account_mem(ctx, imu->acct_pages).", leading to evevntual -ENOMEM. Initialise the field. Reported-by: Andres Freund <[email protected]> Fixes: 41edf1a ("io_uring: keep table of pointers to ubufs") Signed-off-by: Pavel Begunkov <[email protected]> Link: https://lore.kernel.org/r/438a6f46739ae5e05d9c75a0c8fa235320ff367c.1622285901.git.asml.silence@gmail.com Signed-off-by: Jens Axboe <[email protected]>
1 parent b16ef42 commit 216e583

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

fs/io_uring.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8228,6 +8228,7 @@ static int io_buffer_account_pin(struct io_ring_ctx *ctx, struct page **pages,
82288228
{
82298229
int i, ret;
82308230

8231+
imu->acct_pages = 0;
82318232
for (i = 0; i < nr_pages; i++) {
82328233
if (!PageCompound(pages[i])) {
82338234
imu->acct_pages++;

0 commit comments

Comments
 (0)