]> git.proxmox.com Git - mirror_edk2.git/commit - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c
MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value
authorMichael D Kinney <michael.d.kinney@intel.com>
Tue, 3 Oct 2017 00:22:25 +0000 (17:22 -0700)
committerMichael D Kinney <michael.d.kinney@intel.com>
Mon, 20 Nov 2017 22:43:37 +0000 (14:43 -0800)
commit8d92f819f5a153c1cda5d2978e6434b53bd092a4
tree77aa4f6a3ddcdadc584741a4886088c2d6cdd48f
parentb4e96b82b4e2e47e95014b51787ba5b43abac784
MdeModulePkg/UsbMassStorageDxe: Check Get Max LUN status/value

https://bugzilla.tianocore.org/show_bug.cgi?id=767

If a USB Mass Storage device does not support the Get
Max LUN command, then the USB I/O Protocol ControlTransfer()
service may return an error.  If an error is returned for
this command, then assume that the device does not support
multiple LUNs and return a maximum LUN value of 0.

The USB Mass Storage Class Specification states that a
maximum LUN value larger than 0x0F is invalid.  Add
a check to make sure this maximum LUN value is in this
valid range, and if it is not, then assume that the
device does not support multiple LUNs and return a
maximum LUN value of 0.

This change improves compatibility with USB FLASH drives
that do not support the Get Max LUN command or return
an invalid maximum LUN value.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassBot.c