aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2020-06-05 09:40:36 +0100
committerMichael Brown <mcb30@ipxe.org>2020-06-05 09:44:22 +0100
commitac28bbb7ea3a1c88aa47c086e92fab78a75c351d (patch)
tree12f7398f9bef5c70b8c559cd63c4922b3eaaa0b1
parent18d2162f642fb0e879d5188e7d319add3744b85b (diff)
downloadipxe-ac28bbb7ea3a1c88aa47c086e92fab78a75c351d.zip
ipxe-ac28bbb7ea3a1c88aa47c086e92fab78a75c351d.tar.gz
ipxe-ac28bbb7ea3a1c88aa47c086e92fab78a75c351d.tar.bz2
[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>
-rw-r--r--src/interface/efi/efi_block.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/interface/efi/efi_block.c b/src/interface/efi/efi_block.c
index 91f830a..64d1e19 100644
--- a/src/interface/efi/efi_block.c
+++ b/src/interface/efi/efi_block.c
@@ -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;
}