From: Chen Gang Date: Wed, 11 Sep 2013 21:23:22 +0000 (-0700) Subject: kernel/smp.c: free related resources when failure occurs in hotplug_cfd() X-Git-Tag: v3.12-rc1~52^2~149 X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=60c323699bb308404dcb60e8808531e02651578a;p=~andy%2Flinux 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 Acked-by: Wang YanQing Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/smp.c b/kernel/smp.c index 449b707fc20..3bb6ae533cd 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); }