diff --git a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c index 0b35cbacf0..c35c7bdc12 100644 --- a/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c +++ b/MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c @@ -736,6 +736,13 @@ UsbBootDetectMedia ( return Status; } + // + // Simply reject device whose block size is unacceptable small (==0) or large (>64K). + // + if ((Media->BlockSize == 0) || (Media->BlockSize > USB_BOOT_MAX_CARRY_SIZE)) { + return EFI_DEVICE_ERROR; + } + // // Detect whether it is necessary to reinstall the Block I/O Protocol. //