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.
Unified · Split
| @@ -11065,6 +11065,7 @@ static void io_destroy_buffers(struct io_ring_ctx *ctx) · 11064 unmodified lines | ||
| 11065 | 11065 | xa_for_each(&ctx->io_bl_xa, index, bl) { |
| 11066 | 11066 | xa_erase(&ctx->io_bl_xa, bl->bgid); |
| 11067 | 11067 | __io_remove_buffers(ctx, bl, -1U); |
| 11068 | + kfree(bl); | |
| 11068 | 11069 | } |
| 11069 | 11070 | |
| 11070 | 11071 | while (!list_empty(&ctx->io_buffers_pages)) { |