@@ -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;
}
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(+)