Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 60c32369 authored by Chen Gang's avatar Chen Gang Committed by Linus Torvalds
Browse files

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: default avatarChen Gang <gang.chen@asianux.com>
Acked-by: default avatarWang YanQing <udknight@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent bc5c8f07
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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);
		}