smpboot: fix memory leak on error handling
authorFrederic Weisbecker <[email protected]>
Fri, 4 Sep 2015 22:45:00 +0000 (15:45 -0700)
committerLinus Torvalds <[email protected]>
Fri, 4 Sep 2015 23:54:41 +0000 (16:54 -0700)
The cpumask is allocated before threads get created. If the latter step
fails, we need to free the cpumask.

Signed-off-by: Frederic Weisbecker <[email protected]>
Reviewed-by: Chris Metcalf <[email protected]>
Reviewed-by: Thomas Gleixner <[email protected]>
Cc: Chris Metcalf <[email protected]>
Cc: Don Zickus <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Ulrich Obergfell <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
kernel/smpboot.c

index 7c434c39f02a250f4721475910e881b43b603313..71aa90b69f8fbce718d9a7356c1816d068440f6f 100644 (file)
@@ -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);