44 lines
1.3 KiB
Diff
44 lines
1.3 KiB
Diff
![]() |
From 416eaf86565248e11bfb4ef56b6d5a5e21a4541f Mon Sep 17 00:00:00 2001
|
||
|
From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
|
||
|
Date: Fri, 27 Mar 2015 08:31:27 -0700
|
||
|
Subject: [PATCH] efi: chainloader: take care of unload undershim
|
||
|
|
||
|
Upstream-Status: Inappropriate [embedded specific]
|
||
|
|
||
|
Under shim, we use a custom buffer to put the relocated image, make
|
||
|
sure we free that memory when unloading.
|
||
|
|
||
|
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
|
||
|
---
|
||
|
grub-core/loader/efi/chainloader.c | 14 ++++++++++++--
|
||
|
1 file changed, 12 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
|
||
|
index adaf3c9..285271d 100644
|
||
|
--- a/grub-core/loader/efi/chainloader.c
|
||
|
+++ b/grub-core/loader/efi/chainloader.c
|
||
|
@@ -590,8 +590,18 @@ grub_chainloader_unload (void)
|
||
|
grub_efi_boot_services_t *b;
|
||
|
|
||
|
b = grub_efi_system_table->boot_services;
|
||
|
- efi_call_1 (b->unload_image, image_handle);
|
||
|
- efi_call_2 (b->free_pages, address, pages);
|
||
|
+ if (!shim_used)
|
||
|
+ {
|
||
|
+ efi_call_1 (b->unload_image, image_handle);
|
||
|
+ efi_call_2 (b->free_pages, address, pages);
|
||
|
+ }
|
||
|
+ else
|
||
|
+ {
|
||
|
+ if (shim_buffer)
|
||
|
+ {
|
||
|
+ efi_call_2 (b->free_pages, shim_buffer, shim_pages);
|
||
|
+ }
|
||
|
+ }
|
||
|
|
||
|
grub_free (file_path);
|
||
|
grub_free (cmdline);
|
||
|
--
|
||
|
2.17.1
|
||
|
|