projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6fa6588
)
io_uring: fix memory leak when cache init fail
author
Guixin Liu
<kanie@linux.alibaba.com>
Mon, 23 Sep 2024 10:05:12 +0000
(18:05 +0800)
committer
Jens Axboe
<axboe@kernel.dk>
Tue, 24 Sep 2024 19:31:00 +0000
(13:31 -0600)
Exit the percpu ref when cache init fails to free the data memory with
in struct percpu_ref.
Fixes:
206aefde4f88
("io_uring: reduce/pack size of io_ring_ctx")
Signed-off-by: Guixin Liu <kanie@linux.alibaba.com>
Reviewed-by: Gabriel Krisman Bertazi <krisman@suse.de>
Link:
https://lore.kernel.org/r/20240923100512.64638-1-kanie@linux.alibaba.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/io_uring.c
patch
|
blob
|
history
diff --git
a/io_uring/io_uring.c
b/io_uring/io_uring.c
index
feb61d6
..
c406f5d
100644
(file)
--- a/
io_uring/io_uring.c
+++ b/
io_uring/io_uring.c
@@
-321,7
+321,7
@@
static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
sizeof(struct io_kiocb));
ret |= io_futex_cache_init(ctx);
if (ret)
- goto
err
;
+ goto
free_ref
;
init_completion(&ctx->ref_comp);
xa_init_flags(&ctx->personalities, XA_FLAGS_ALLOC1);
mutex_init(&ctx->uring_lock);
@@
-349,6
+349,9
@@
static __cold struct io_ring_ctx *io_ring_ctx_alloc(struct io_uring_params *p)
io_napi_init(ctx);
return ctx;
+
+free_ref:
+ percpu_ref_exit(&ctx->refs);
err:
io_alloc_cache_free(&ctx->rsrc_node_cache, kfree);
io_alloc_cache_free(&ctx->apoll_cache, kfree);