From: Frederic Weisbecker Date: Fri, 4 Sep 2015 22:45:00 +0000 (-0700) Subject: smpboot: fix memory leak on error handling X-Git-Tag: firefly_0821_release~176^2~1136^2~67 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=5869b5064b0950afc447610c0f5d4134b71d9e94;p=firefly-linux-kernel-4.4.55.git smpboot: fix memory leak on error handling The cpumask is allocated before threads get created. If the latter step fails, we need to free the cpumask. Signed-off-by: Frederic Weisbecker Reviewed-by: Chris Metcalf Reviewed-by: Thomas Gleixner Cc: Chris Metcalf Cc: Don Zickus Cc: Peter Zijlstra Cc: Ulrich Obergfell Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/kernel/smpboot.c b/kernel/smpboot.c index 7c434c39f02a..71aa90b69f8f 100644 --- a/kernel/smpboot.c +++ b/kernel/smpboot.c @@ -301,6 +301,7 @@ int smpboot_register_percpu_thread(struct smp_hotplug_thread *plug_thread) ret = __smpboot_create_thread(plug_thread, cpu); if (ret) { smpboot_destroy_threads(plug_thread); + free_cpumask_var(plug_thread->cpumask); goto out; } smpboot_unpark_thread(plug_thread, cpu);