diff options
author | Chen Gang <gang.chen@asianux.com> | 2013-09-11 14:23:22 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-09-11 15:58:21 -0700 |
commit | 60c323699bb308404dcb60e8808531e02651578a (patch) | |
tree | 978d94c566d4ad2a23ae2fe656a666b61c1f4f4e | |
parent | bc5c8f0783a4a2b43d05155782e71a22a91b26a5 (diff) | |
download | linux-60c323699bb308404dcb60e8808531e02651578a.tar.gz linux-60c323699bb308404dcb60e8808531e02651578a.tar.bz2 linux-60c323699bb308404dcb60e8808531e02651578a.zip |
kernel/smp.c: free related resources when failure occurs in hotplug_cfd()
When failure occurs in hotplug_cfd(), need release related resources, or
will cause memory leak.
Signed-off-by: Chen Gang <gang.chen@asianux.com>
Acked-by: Wang YanQing <udknight@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/smp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/smp.c b/kernel/smp.c index 449b707fc20d..3bb6ae533cdf 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -48,10 +48,13 @@ hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu) cpu_to_node(cpu))) return notifier_from_errno(-ENOMEM); if (!zalloc_cpumask_var_node(&cfd->cpumask_ipi, GFP_KERNEL, - cpu_to_node(cpu))) + cpu_to_node(cpu))) { + free_cpumask_var(cfd->cpumask); return notifier_from_errno(-ENOMEM); + } cfd->csd = alloc_percpu(struct call_single_data); if (!cfd->csd) { + free_cpumask_var(cfd->cpumask_ipi); free_cpumask_var(cfd->cpumask); return notifier_from_errno(-ENOMEM); } |