[efi] Work around UEFI specification bug in LoadImage for SAN boot

As described in the previous commit, work around a UEFI specification
bug that necessitates calling UnloadImage if the return value from
LoadImage is EFI_SECURITY_VIOLATION.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
pull/115/head
Michael Brown 2020-06-05 09:40:36 +01:00
parent 18d2162f64
commit ac28bbb7ea
1 changed files with 3 additions and 0 deletions

View File

@ -594,11 +594,14 @@ static int efi_block_boot_image ( struct san_device *sandev, EFI_HANDLE handle,
sandev->drive, efi_devpath_text ( boot_path ) );
/* Try loading boot image from this device */
*image = NULL;
if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, boot_path,
NULL, 0, image ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( sandev, "EFIBLK %#02x could not load image: %s\n",
sandev->drive, strerror ( rc ) );
if ( efirc == EFI_SECURITY_VIOLATION )
bs->UnloadImage ( *image );
goto err_load_image;
}