lkml.org 
[lkml]   [2019]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 2/2] x86/efi: Fix memory leak for EFI memmap reservations
From
Date
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@huawei.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
\
 
 \ /
  Last update: 2019-09-25 11:21    [W:0.049 / U:1.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site