Signed-off-by: Mate Kukri <mate.ku...@canonical.com>
---
 grub-core/loader/efi/linux.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/grub-core/loader/efi/linux.c b/grub-core/loader/efi/linux.c
index 9cd84ab12..1829d5689 100644
--- a/grub-core/loader/efi/linux.c
+++ b/grub-core/loader/efi/linux.c
@@ -206,11 +206,15 @@ grub_arch_efi_linux_boot_image (grub_addr_t addr, 
grub_size_t size, char *args)
   mempath[1].header.subtype = GRUB_EFI_END_ENTIRE_DEVICE_PATH_SUBTYPE;
   mempath[1].header.length = sizeof (grub_efi_device_path_t);
 
-  status = grub_efi_load_image (0, grub_efi_image_handle,
-                               (grub_efi_device_path_t *)mempath,
-                               (void *)addr, size, &image_handle);
-  if (status != GRUB_EFI_SUCCESS)
-    return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
+  image_handle = grub_efi_get_last_verified_image_handle ();
+  if (image_handle == NULL)
+    {
+      status = grub_efi_load_image (0, grub_efi_image_handle,
+                                   (grub_efi_device_path_t *)mempath,
+                                   (void *)addr, size, &image_handle);
+      if (status != GRUB_EFI_SUCCESS)
+       return grub_error (GRUB_ERR_BAD_OS, "cannot load image");
+    }
 
   grub_dprintf ("linux", "linux command line: '%s'\n", args);
 
-- 
2.39.5


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to