mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 10:31:46 +09:00
Merge a00113dc99 ("io_uring: add ring freeing helper") into android14-6.1-lts
Steps on the way to 6.1.132 Change-Id: I9f0911dea5c70c457e87c0fe3a6920bc00e773f7 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
@@ -2525,6 +2525,14 @@ static void io_mem_free(void *ptr)
|
||||
free_compound_page(page);
|
||||
}
|
||||
|
||||
static void io_rings_free(struct io_ring_ctx *ctx)
|
||||
{
|
||||
io_mem_free(ctx->rings);
|
||||
io_mem_free(ctx->sq_sqes);
|
||||
ctx->rings = NULL;
|
||||
ctx->sq_sqes = NULL;
|
||||
}
|
||||
|
||||
static void *io_mem_alloc(size_t size)
|
||||
{
|
||||
gfp_t gfp = GFP_KERNEL_ACCOUNT | __GFP_ZERO | __GFP_NOWARN | __GFP_COMP;
|
||||
@@ -2684,8 +2692,7 @@ static __cold void io_ring_ctx_free(struct io_ring_ctx *ctx)
|
||||
mmdrop(ctx->mm_account);
|
||||
ctx->mm_account = NULL;
|
||||
}
|
||||
io_mem_free(ctx->rings);
|
||||
io_mem_free(ctx->sq_sqes);
|
||||
io_rings_free(ctx);
|
||||
|
||||
percpu_ref_exit(&ctx->refs);
|
||||
free_uid(ctx->user);
|
||||
@@ -3452,15 +3459,13 @@ static __cold int io_allocate_scq_urings(struct io_ring_ctx *ctx,
|
||||
else
|
||||
size = array_size(sizeof(struct io_uring_sqe), p->sq_entries);
|
||||
if (size == SIZE_MAX) {
|
||||
io_mem_free(ctx->rings);
|
||||
ctx->rings = NULL;
|
||||
io_rings_free(ctx);
|
||||
return -EOVERFLOW;
|
||||
}
|
||||
|
||||
ptr = io_mem_alloc(size);
|
||||
if (IS_ERR(ptr)) {
|
||||
io_mem_free(ctx->rings);
|
||||
ctx->rings = NULL;
|
||||
io_rings_free(ctx);
|
||||
return PTR_ERR(ptr);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user