From: Sai Praneeth <sai.praneeth.prak...@intel.com>

efi_memmap_install(), unmaps the existing memory map and installs the
new memory map but doesn't free the memory allocated to the existing
memory map. Fortunately, the details about the existing memory map are
stored in efi.memmap. Hence, use them to free the memory.

Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prak...@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheu...@linaro.org>
Cc: Lee Chun-Yi <j...@suse.com>
Cc: Borislav Petkov <b...@alien8.de>
Cc: Dave Young <dyo...@redhat.com>
Cc: Laszlo Ersek <ler...@redhat.com>
Cc: Bhupesh Sharma <bhsha...@redhat.com>
Cc: Ricardo Neri <ricardo.n...@intel.com>
Cc: Ravi Shankar <ravi.v.shan...@intel.com>
Cc: Matt Fleming <m...@codeblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheu...@linaro.org>
---

Note: Patch based on efi tree 
@https://git.kernel.org/pub/scm/linux/kernel/git/efi/efi.git

 drivers/firmware/efi/memmap.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c
index 678e85704054..68b27b14fe94 100644
--- a/drivers/firmware/efi/memmap.c
+++ b/drivers/firmware/efi/memmap.c
@@ -229,6 +229,9 @@ int __init efi_memmap_install(phys_addr_t addr, unsigned 
int nr_map)
 
        efi_memmap_unmap();
 
+       /* Free the memory allocated to the existing memory map */
+       efi_memmap_free(efi.memmap.phys_map, efi.memmap.nr_map, 
efi.memmap.late);
+
        data.phys_map = addr;
        data.size = efi.memmap.desc_size * nr_map;
        data.desc_version = efi.memmap.desc_version;
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-efi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to