]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Fix exit to EFI firmware
authorMark Salter <msalter@redhat.com>
Fri, 15 Aug 2014 16:22:43 +0000 (12:22 -0400)
committerAndrei Borzenkov <arvidjaar@gmail.com>
Fri, 12 Jun 2015 10:08:36 +0000 (13:08 +0300)
The current code for EFI grub_exit() calls grub_efi_fini() before
returning to firmware. In the case of ARM, this leaves a timer
event running which could lead to a firmware crash. This patch
changes this so that grub_machine_fini() is called with a NORETURN
flag. This allows machine-specific shutdown to happen as well
as the shutdown done by grub_efi_fini().

Signed-off-by: Mark Salter <msalter@redhat.com>
grub-core/kern/arm/efi/init.c
grub-core/kern/efi/efi.c

index a6ae03475ccb8111acf8f3d56a4f875c07cbff23..2572ca8b7f78cd0b95098409b06f5b70a6d7caa6 100644 (file)
@@ -67,7 +67,7 @@ grub_machine_fini (int flags)
 
   b = grub_efi_system_table->boot_services;
 
-  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0);
+  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_CANCEL, 0);
   efi_call_1 (b->close_event, tmr_evt);
 
   grub_efi_fini ();
index 49a150133539fff45e1fec7542742564d731819c..2e7783468d7704fb89d47a6b51eb7d1ae59c6bb4 100644 (file)
@@ -27,6 +27,7 @@
 #include <grub/term.h>
 #include <grub/kernel.h>
 #include <grub/mm.h>
+#include <grub/loader.h>
 
 /* The handle of GRUB itself. Filled in by the startup code.  */
 grub_efi_handle_t grub_efi_image_handle;
@@ -156,7 +157,7 @@ grub_efi_get_loaded_image (grub_efi_handle_t image_handle)
 void
 grub_exit (void)
 {
-  grub_efi_fini ();
+  grub_machine_fini (GRUB_LOADER_FLAG_NORETURN);
   efi_call_4 (grub_efi_system_table->boot_services->exit,
               grub_efi_image_handle, GRUB_EFI_SUCCESS, 0, 0);
   for (;;) ;