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

[Xen-changelog] [xen stable-4.4] efi: fix allocation problems if ExitBootServices() fails



commit 6ed66bfdd16a96325955ccdd962248aeec107d8c
Author:     Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
AuthorDate: Thu Jun 18 09:32:40 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jun 18 09:32:40 2015 +0200

    efi: fix allocation problems if ExitBootServices() fails
    
    If calling ExitBootServices() fails, the required memory map size may
    have increased. When initially allocating the memory map, allocate a
    slightly larger buffer (by an arbitrary 8 entries) to fix this.
    
    The ARM code path was already allocating a larger buffer than required,
    so this moves the code to be common for all architectures.
    
    This was seen on the following machine when using the iscsidxe UEFI
    driver. The machine would consistently fail the first call to
    ExitBootServices().
    System Information
            Manufacturer: Supermicro
            Product Name: X10SLE-F/HF
    BIOS Information
            Vendor: American Megatrends Inc.
            Version: 2.00
            Release Date: 04/24/2014
    
    Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Roy Franz <roy.franz@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    
    EFI: map allocation size must be set to zero
    
    Commit 8a753b3f1c ("efi: fix allocation problems if ExitBootServices()
    fails") replaced the use of a static (and hence zero-initialized)
    variable by an automatic (and hence uninitialized) one.
    
    Also drop the variable introduced by that commit in favor of re-using
    another available and suitable one.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
    Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
    master commit: 8a753b3f1cf5e4714974196df9517849bf174324
    master date: 2015-06-02 13:44:24 +0200
    master commit: 4c94684bb7c20ff01d03fb1f22c03cc0c2fc417b
    master date: 2015-06-11 14:47:54 +0200
---
 xen/arch/x86/efi/boot.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/efi/boot.c b/xen/arch/x86/efi/boot.c
index de240f8..598cf76 100644
--- a/xen/arch/x86/efi/boot.c
+++ b/xen/arch/x86/efi/boot.c
@@ -1379,9 +1379,11 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
*SystemTable)
         }
     }
 
-    status = efi_bs->GetMemoryMap(&efi_memmap_size, NULL, &map_key,
-                                  &efi_mdesc_size, &mdesc_ver);
-    mbi.mem_upper -= efi_memmap_size;
+    info_size = 0;
+    efi_bs->GetMemoryMap(&info_size, NULL, &map_key,
+                         &efi_mdesc_size, &mdesc_ver);
+    info_size += 8 * efi_mdesc_size;
+    mbi.mem_upper -= info_size;
     mbi.mem_upper &= -__alignof__(EFI_MEMORY_DESCRIPTOR);
     if ( mbi.mem_upper < xen_phys_start )
         blexit(L"Out of static memory");
@@ -1390,6 +1392,7 @@ efi_start(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE 
*SystemTable)
     {
         struct e820entry *e;
 
+        efi_memmap_size = info_size;
         status = efi_bs->GetMemoryMap(&efi_memmap_size, efi_memmap, &map_key,
                                       &efi_mdesc_size, &mdesc_ver);
         if ( EFI_ERROR(status) )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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