lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Sep 2019 17:20:06 +0800
From:   Yunfeng Ye <yeyunfeng@...wei.com>
To:     "ard.biesheuvel@...aro.org" <ard.biesheuvel@...aro.org>,
        <dvhart@...radead.org>, <andy@...radead.org>,
        "tglx@...utronix.de" <tglx@...utronix.de>, <mingo@...hat.com>,
        <bp@...en8.de>, <hpa@...or.com>, <x86@...nel.org>
CC:     <linux-efi@...r.kernel.org>, <platform-driver-x86@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/2] x86/efi: Fix memory leak for EFI memmap reservations

There are some memory leaks in failure path after efi_memmap_alloc().
add efi_memmap_free() for this situation.

Fixes: 816e76129ed5 ("efi: Allow drivers to reserve boot services forever")
Signed-off-by: Yunfeng Ye <yeyunfeng@...wei.com>
---
 arch/x86/platform/efi/quirks.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index 3b9fd67..a755f35 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -285,6 +285,7 @@ void __init efi_arch_mem_reserve(phys_addr_t addr, u64 size)

 	new = early_memremap(new_phys, new_size);
 	if (!new) {
+		efi_memmap_free(new_phys, num_entries);
 		pr_err("Failed to map new boot services memmap\n");
 		return;
 	}
@@ -470,6 +471,7 @@ void __init efi_free_boot_services(void)

 	new = memremap(new_phys, new_size, MEMREMAP_WB);
 	if (!new) {
+		efi_memmap_free(new_phys, num_entries);
 		pr_err("Failed to map new EFI memmap\n");
 		return;
 	}
@@ -493,6 +495,7 @@ void __init efi_free_boot_services(void)
 	memunmap(new);

 	if (efi_memmap_install(new_phys, num_entries)) {
+		efi_memmap_free(new_phys, num_entries);
 		pr_err("Could not install new EFI memmap\n");
 		return;
 	}
-- 
1.8.3.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ