]> git.baikalelectronics.ru Git - kernel.git/commit
workqueue: Fix possible memory leaks in wq_numa_init()
authorZhen Lei <thunder.leizhen@huawei.com>
Thu, 22 Jul 2021 03:03:52 +0000 (11:03 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Sep 2021 10:26:30 +0000 (12:26 +0200)
commit781240211b31277a8cf343dc942662b6e8ae3710
treea2d5c1e34fe1c6e11ec118596afdfacf417ec1d3
parent6d743555cca5ee14c6645c318f564049b6695466
workqueue: Fix possible memory leaks in wq_numa_init()

[ Upstream commit f728c4a9e8405caae69d4bc1232c54ff57b5d20f ]

In error handling branch "if (WARN_ON(node == NUMA_NO_NODE))", the
previously allocated memories are not released. Doing this before
allocating memory eliminates memory leaks.

tj: Note that the condition only occurs when the arch code is pretty broken
and the WARN_ON might as well be BUG_ON().

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
Reviewed-by: Lai Jiangshan <jiangshanlai@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/workqueue.c