diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-10-16 12:40:13 +0800 |
---|---|---|
committer | Ruiyu Ni <ruiyu.ni@intel.com> | 2018-10-17 11:04:06 +0800 |
commit | 25d310d9b6187ca2e770b0b959831416441ce271 (patch) | |
tree | 1e57adb28cb028196d64a70b899366d476a8c2db | |
parent | 8894c90d745109c4aea3998c09a8f2b1f10a6d04 (diff) | |
download | edk2-25d310d9b6187ca2e770b0b959831416441ce271.tar.gz edk2-25d310d9b6187ca2e770b0b959831416441ce271.tar.bz2 edk2-25d310d9b6187ca2e770b0b959831416441ce271.zip |
MdeModulePkg/UsbMass: Reject device whose block size is 0 or > 64K
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBoot.c | 7 |
1 files changed, 7 insertions, 0 deletions
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 @@ -737,6 +737,13 @@ UsbBootDetectMedia ( }
//
+ // 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.
//
// MediaId may change in RequestSense for MediaChanged
|