linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yi Wang <wang.yi59@zte.com.cn>
To: tj@kernel.org
Cc: jiangshanlai@gmail.com, linux-kernel@vger.kernel.org,
	jiang.biao2@zte.com.cn, wang.yi59@zte.com.cn,
	zhong.weidong@zte.com.cn
Subject: [PATCH] workqueue: fix memory leak in wq_numa_init()
Date: Mon, 6 Aug 2018 09:20:39 +0800	[thread overview]
Message-ID: <1533518439-3982-1-git-send-email-wang.yi59@zte.com.cn> (raw)

The 'tbl' variable may leak when return in function
wq_numa_init(), and this patch fixes this.

Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
---
 kernel/workqueue.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 78b1920..9321a05 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5649,6 +5649,7 @@ static void __init wq_numa_init(void)
 		node = cpu_to_node(cpu);
 		if (WARN_ON(node == NUMA_NO_NODE)) {
 			pr_warn("workqueue: NUMA node mapping not available for cpu%d, disabling NUMA support\n", cpu);
+			kfree(tbl);
 			/* happens iff arch is bonkers, let's just proceed */
 			return;
 		}
-- 
1.8.3.1


             reply	other threads:[~2018-08-06  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06  1:20 Yi Wang [this message]
     [not found] ` <201808201205500126227@zte.com.cn>
2018-08-20 16:00   ` Tejun Heo

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 \
    --in-reply-to=1533518439-3982-1-git-send-email-wang.yi59@zte.com.cn \
    --to=wang.yi59@zte.com.cn \
    --cc=jiang.biao2@zte.com.cn \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=zhong.weidong@zte.com.cn \
    --subject='Re: [PATCH] workqueue: fix memory leak in wq_numa_init()' \
    /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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).