x86/boot: Fix memory leak in default_get_smp_config()
authorDavid Rientjes <rientjes@google.com>
Wed, 10 Jul 2019 02:44:03 +0000 (19:44 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jul 2019 05:28:39 +0000 (07:28 +0200)
commit531a502517f7409692295431207c1b39c4ffd275
tree8fcc02e4f8c540f6e3ae34ae64fde29d226b8971
parent4d96a2a09bf3347825aa67cc3f59d9891a90c2ce
x86/boot: Fix memory leak in default_get_smp_config()

commit e74bd96989dd42a51a73eddb4a5510a6f5e42ac3 upstream.

When default_get_smp_config() is called with early == 1 and mpf->feature1
is non-zero, mpf is leaked because the return path does not do
early_memunmap().

Fix this and share a common exit routine.

Fixes: 5997efb96756 ("x86/boot: Use memremap() to map the MPF and MPC data")
Reported-by: Cfir Cohen <cfir@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/alpine.DEB.2.21.1907091942570.28240@chino.kir.corp.google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/x86/kernel/mpparse.c