lkml.org 
[lkml]   [2021]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH -next] io-wq: Fix memory leak in create_io_worker
Date
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: syzbot+65454c239241d3d647da@syzkaller.appspotmail.com
Signed-off-by: Bixuan Cui <cuibixuan@huawei.com>
---
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
\
 
 \ /
  Last update: 2021-09-09 10:54    [W:0.035 / U:0.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site