• Zach Bobroff's avatar
    x86, efi: retry ExitBootServices() on failure · 587562a7
    Zach Bobroff authored
    commit d3768d88 upstream.
    
    ExitBootServices is absolutely supposed to return a failure if any
    ExitBootServices event handler changes the memory map.  Basically the
    get_map loop should run again if ExitBootServices returns an error the
    first time.  I would say it would be fair that if ExitBootServices gives
    an error the second time then Linux would be fine in returning control
    back to BIOS.
    
    The second change is the following line:
    
    again:
            size += sizeof(*mem_map) * 2;
    
    Originally you were incrementing it by the size of one memory map entry.
    The issue here is all related to the low_alloc routine you are using.
    In this routine you are making allocations to get the memory map itself.
    Doing this allocation or allocations can affect the memory map by more
    than one record.
    
    [ mfleming - changelog, code style ]
    Signed-off-by: default avatarZach Bobroff <zacharyb@ami.com>
    Signed-off-by: default avatarMatt Fleming <matt.fleming@intel.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    587562a7
eboot.c 29.2 KB