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>
This commit is contained in:
Ruiyu Ni 2018-10-16 12:40:13 +08:00
parent 8894c90d74
commit 25d310d9b6
1 changed files with 7 additions and 0 deletions

View File

@ -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.
//