OSDN Git Service

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)
committerTejun Heo <tj@kernel.org>
Thu, 29 Jul 2021 17:16:00 +0000 (07:16 -1000)
commitf728c4a9e8405caae69d4bc1232c54ff57b5d20f
treea8a92303b2fab1c7f718d1a48e1737b73d95abdd
parent7e96bf476270aecea66740a083e51b38c1371cd2
workqueue: Fix possible memory leaks in wq_numa_init()

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>
kernel/workqueue.c