All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] efi: Free existing memory map before installing new memory map
@ 2018-06-26  2:41 Sai Praneeth Prakhya
  2018-06-26  3:15   ` kbuild test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Sai Praneeth Prakhya @ 2018-06-26  2:41 UTC (permalink / raw)
  To: linux-efi, linux-kernel
  Cc: Sai Praneeth, Lee Chun-Yi, Borislav Petkov, Dave Young,
	Laszlo Ersek, Bhupesh Sharma, Ricardo Neri, Ravi Shankar,
	Matt Fleming, Ard Biesheuvel

From: Sai Praneeth <sai.praneeth.prakhya@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.prakhya@intel.com>
Reported-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Lee Chun-Yi <jlee@suse.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Young <dyoung@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Bhupesh Sharma <bhsharma@redhat.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Ard Biesheuvel <ard.biesheuvel@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

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2018-06-27  7:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26  2:41 [PATCH] efi: Free existing memory map before installing new memory map Sai Praneeth Prakhya
2018-06-26  3:15 ` kbuild test robot
2018-06-26  3:15   ` kbuild test robot
2018-06-26  3:15 ` kbuild test robot
2018-06-26  3:15   ` kbuild test robot
2018-06-26  7:18   ` Prakhya, Sai Praneeth
2018-06-27  6:02     ` [kbuild-all] " Ye Xiaolong
2018-06-27  6:09       ` Ard Biesheuvel
2018-06-27  6:29         ` Ye Xiaolong
2018-06-27  6:32       ` Prakhya, Sai Praneeth
2018-06-26  9:38 ` Ard Biesheuvel
2018-06-27  4:51   ` Prakhya, Sai Praneeth
2018-06-27  7:01     ` Ard Biesheuvel
2018-06-27  7:28       ` Prakhya, Sai Praneeth

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.