Skip to contentSkip to conversation

io-wq: Fix memory leak in create_io_worker

PATCH Superseded Bixuan Cui 2 participants 2 messages Sep 9, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Bixuan Cui

author
#0 lore raw

PATCH 1/1 io-wq: Fix memory leak in create_io_worker

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]
---
 fs/io-wq.c | 1 +
 1 file changed, 1 insertion(+)
fs/io-wq.c +1 -0
index d80e4a735677..036953f334d4 100644
@@ -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);
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 1 line · Bixuan Cui

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

This one is incomplete, see other postings.

Signature · 1 line
Jens Axboe