[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] xen-efi: fix boot for pre-UEFI systems



efi/boot.c makes a call to QueryVariableInfo on all systems.  However,
as it is only promised for UEFI 2.0+ systems, pre-UEFI systems can
hang or crash on this call.  The below patch adds a version check, a
technique used in other parts of the Xen EFI codebase.

Signed-off-by: Eric Shelton <eshelton@xxxxxxxxx>


diff -ur a/xen/xen/arch/x86/efi/boot.c b/xen/xen/arch/x86/efi/boot.c
--- a/xen/xen/arch/x86/efi/boot.c 2013-05-22 22:01:43.340000000 -0400
+++ b/xen/xen/arch/x86/efi/boot.c 2013-05-22 22:01:25.712000000 -0400
@@ -1241,12 +1241,20 @@
     setup_efi_pci();

     /* Get snapshot of variable store parameters. */
-    status = efi_rs->QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE |
-                                       EFI_VARIABLE_BOOTSERVICE_ACCESS |
-                                       EFI_VARIABLE_RUNTIME_ACCESS,
-                                       &efi_boot_max_var_store_size,
-                                       &efi_boot_remain_var_store_size,
-                                       &efi_boot_max_var_size);
+    if ((efi_version >> 16) < 2)
+    {
+        status = EFI_INCOMPATIBLE_VERSION;
+    }
+    else
+    {
+        /* only available in UEFI ver 2.0+ */
+        status = efi_rs->QueryVariableInfo(EFI_VARIABLE_NON_VOLATILE |
+                                           EFI_VARIABLE_BOOTSERVICE_ACCESS |
+                                           EFI_VARIABLE_RUNTIME_ACCESS,
+                                           &efi_boot_max_var_store_size,
+                                           &efi_boot_remain_var_store_size,
+                                           &efi_boot_max_var_size);
+    }
     if ( EFI_ERROR(status) )
     {
         efi_boot_max_var_store_size = 0;

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.