From: Bixuan Cui <[email protected]>
To: <[email protected]>, <[email protected]>
Cc: <[email protected]>, <[email protected]>, <[email protected]>
Subject: [PATCH -next] io-wq: Fix memory leak in create_io_worker
Date: Thu, 9 Sep 2021 16:49:19 +0800 [thread overview]
Message-ID: <[email protected]> (raw)
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
next reply other threads:[~2021-09-09 8:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-09 8:49 Bixuan Cui [this message]
2021-09-09 12:58 ` [PATCH -next] io-wq: Fix memory leak in create_io_worker Jens Axboe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox