x86/boot: Fix memory leak in default_get_smp_config()
commite74bd96989upstream. 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:5997efb967("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>
This commit is contained in:
parent
b52807e607
commit
0d4c0bb706
1 changed files with 4 additions and 6 deletions
|
|
@ -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));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue