Skip to content

Commit 747b762

Browse files
committed
Merge tag 'io_uring-6.6-2023-10-20' of git://git.kernel.dk/linux
Pull io_uring fix from Jens Axboe: "Just a single fix for a bug report that came in, fixing a case where failure to init a ring with IORING_SETUP_NO_MMAP can trigger a NULL pointer dereference" * tag 'io_uring-6.6-2023-10-20' of git://git.kernel.dk/linux: io_uring: fix crash with IORING_SETUP_NO_MMAP and invalid SQ ring address
2 parents 14f6863 + 8b51a39 commit 747b762

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

io_uring/io_uring.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2674,7 +2674,11 @@ static void io_pages_free(struct page ***pages, int npages)
26742674

26752675
if (!pages)
26762676
return;
2677+
26772678
page_array = *pages;
2679+
if (!page_array)
2680+
return;
2681+
26782682
for (i = 0; i < npages; i++)
26792683
unpin_user_page(page_array[i]);
26802684
kvfree(page_array);
@@ -2758,7 +2762,9 @@ static void io_rings_free(struct io_ring_ctx *ctx)
27582762
ctx->sq_sqes = NULL;
27592763
} else {
27602764
io_pages_free(&ctx->ring_pages, ctx->n_ring_pages);
2765+
ctx->n_ring_pages = 0;
27612766
io_pages_free(&ctx->sqe_pages, ctx->n_sqe_pages);
2767+
ctx->n_sqe_pages = 0;
27622768
}
27632769
}
27642770

0 commit comments

Comments
 (0)