public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH -next] io-wq: Fix memory leak in create_io_worker
@ 2021-09-09  8:49 Bixuan Cui
  2021-09-09 12:58 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Bixuan Cui @ 2021-09-09  8:49 UTC (permalink / raw)
  To: linux-kernel, io-uring; +Cc: axboe, asml.silence, john.wanghui

If io_should_retry_thread is false, free the worker before goto fails.

Fixes: 3146cba99aa2 ("io-wq: make worker creation resilient against signals")
Reported-by: [email protected]
Signed-off-by: Bixuan Cui <[email protected]>
---
 fs/io-wq.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/io-wq.c b/fs/io-wq.c
index d80e4a735677..036953f334d4 100644
--- a/fs/io-wq.c
+++ b/fs/io-wq.c
@@ -759,6 +759,7 @@ static bool create_io_worker(struct io_wq *wq, struct io_wqe *wqe, int index)
 	if (!IS_ERR(tsk)) {
 		io_init_new_worker(wqe, worker, tsk);
 	} else if (!io_should_retry_thread(PTR_ERR(tsk))) {
+		kfree(worker);
 		goto fail;
 	} else {
 		INIT_WORK(&worker->work, io_workqueue_create);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH -next] io-wq: Fix memory leak in create_io_worker
  2021-09-09  8:49 [PATCH -next] io-wq: Fix memory leak in create_io_worker Bixuan Cui
@ 2021-09-09 12:58 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-09-09 12:58 UTC (permalink / raw)
  To: Bixuan Cui, linux-kernel, io-uring; +Cc: asml.silence, john.wanghui

On 9/9/21 2:49 AM, Bixuan Cui wrote:
> If io_should_retry_thread is false, free the worker before goto fails.

This one is incomplete, see other postings.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-09 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-09  8:49 [PATCH -next] io-wq: Fix memory leak in create_io_worker Bixuan Cui
2021-09-09 12:58 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox