]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg/UefiBootManangerLib: Fix exception issue
authorMing Huang <ming.huang@linaro.org>
Tue, 19 Mar 2019 12:59:13 +0000 (20:59 +0800)
committerHao Wu <hao.a.wu@intel.com>
Thu, 21 Mar 2019 01:09:43 +0000 (09:09 +0800)
The system environment: virtual-CDROM(USB interface) via BMC, insert a
iso file to CDROM, like ubuntu-18.04.1-server-arm64.iso, change CDROM
to first boot option.
With release version bios, disconnecting CDROM when boot to
"1 seconds left, Press Esc or F2 to enter Setup"
then system will get a exception.

The root cause is the EFI_BLOCK_IO_PROTOCOL for UsbMass will be uninstalled
in this situation after print some transfer error. The status will be
invalid parameter. This line will get a exception for BlockIo not point
to right address:
AllocatePool (BlockIo->Media->BlockSize)
So, here need to judge the status after ASSERT_EFI_ERROR.

The Bugzilla tracker for this:
https://bugzilla.tianocore.org/show_bug.cgi?id=1631

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ming Huang <ming.huang@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c

index 4ce83ce22d617620ceb98f90824525da9c2b358c..0535cd7335b43162a798069dd77a35fbca5500fb 100644 (file)
@@ -1069,6 +1069,9 @@ BmExpandMediaDevicePath (
   //\r
   Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);\r
   ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status)) {\r
+    return NULL;\r
+  }\r
   Buffer = AllocatePool (BlockIo->Media->BlockSize);\r
   if (Buffer != NULL) {\r
     BlockIo->ReadBlocks (\r