Skip to content

Commit

Permalink
io_uring: fix a memory leak of buffer group list on exit
Browse files Browse the repository at this point in the history
If we use a buffer group ID that is large enough to require io_uring
to allocate it, then we don't correctly free it if the cleanup is
deferred to the ring exit. The explicit removal paths are fine.

Fixes: 9cfc7e9 ("io_uring: get rid of hashed provided buffer groups")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
  • Loading branch information
Jens Axboe committed May 31, 2022
1 parent 1151a7c commit 21870e0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -11065,6 +11065,7 @@ static void io_destroy_buffers(struct io_ring_ctx *ctx)
xa_for_each(&ctx->io_bl_xa, index, bl) {
xa_erase(&ctx->io_bl_xa, bl->bgid);
__io_remove_buffers(ctx, bl, -1U);
kfree(bl);
}

while (!list_empty(&ctx->io_buffers_pages)) {
Expand Down

0 comments on commit 21870e0

Please sign in to comment.