summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2019-07-09 19:44:03 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-26 09:14:25 +0200
commit0d4c0bb706653ebc52cbf5adaa68d73f108488c2 (patch)
treeaab57806e53839ae4a4a3c6ce518f5238b73589d /arch
parentb52807e607f19d763ad19c2cdfcb7ef834a15259 (diff)
downloadlinux-stable-0d4c0bb706653ebc52cbf5adaa68d73f108488c2.tar.gz
linux-stable-0d4c0bb706653ebc52cbf5adaa68d73f108488c2.tar.bz2
linux-stable-0d4c0bb706653ebc52cbf5adaa68d73f108488c2.zip
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>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/kernel/mpparse.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index ddb1ca6923b1..5b4c32799094 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -547,17 +547,15 @@ void __init default_get_smp_config(unsigned int early)
* local APIC has default address
*/
mp_lapic_addr = APIC_DEFAULT_PHYS_BASE;
- return;
+ goto out;
}
pr_info("Default MP configuration #%d\n", mpf->feature1);
construct_default_ISA_mptable(mpf->feature1);
} else if (mpf->physptr) {
- if (check_physptr(mpf, early)) {
- early_memunmap(mpf, sizeof(*mpf));
- return;
- }
+ if (check_physptr(mpf, early))
+ goto out;
} else
BUG();
@@ -566,7 +564,7 @@ void __init default_get_smp_config(unsigned int early)
/*
* Only use the first configuration found.
*/
-
+out:
early_memunmap(mpf, sizeof(*mpf));
}