mirror_edk2/MdeModulePkg
Star Zeng acebdf14c9 MdeModulePkg UsbBusDxe: Fix wrong buffer length used to read hub desc
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=973

HUB descriptor has variable length.
But the code uses stack (HubDesc in UsbHubInit) with fixed length
sizeof(EFI_USB_HUB_DESCRIPTOR) to hold HUB descriptor data.
It uses hard code length value (32 that is greater than
sizeof(EFI_USB_HUB_DESCRIPTOR)) for SuperSpeed path, then there will
be stack overflow when IOMMU is enabled because the Unmap operation
will copy the data from device buffer to host buffer.
And it uses HubDesc->Length for none SuperSpeed path, then there will
be stack overflow when HubDesc->Length is greater than
sizeof(EFI_USB_HUB_DESCRIPTOR).

The patch updates the code to use a big enough buffer to hold the
descriptor data.
The definition EFI_USB_SUPER_SPEED_HUB_DESCRIPTOR is wrong (HubDelay
field should be UINT16 type) and no code is using it, the patch
removes it.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Bret Barkelew <bret.barkelew@microsoft.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com>
2018-06-27 12:38:47 +08:00
..
Application MdeModulePkg BootManagerMenuApp: Update usage info for BootLogo protocol 2018-06-05 14:23:48 +08:00
Bus MdeModulePkg UsbBusDxe: Fix wrong buffer length used to read hub desc 2018-06-27 12:38:47 +08:00
Core MdeModulePkg: Use new added Perf macros 2018-06-26 15:36:59 +08:00
Include MdeModulePkg: Update performance library instances 2018-06-26 15:36:51 +08:00
Library MdeModulePkg: Use new added Perf macros 2018-06-26 15:36:59 +08:00
Logo MdeModulePkg/Logo.idf: Remove incorrect comments. 2018-02-28 15:30:23 +08:00
Universal MdeModulePkg: Use new added Perf macros 2018-06-26 15:36:59 +08:00
MdeModulePkg.dec MdeModulePkg: Add PERFORMANCE_MEASUREMENT_PROTOCOL 2018-06-26 15:36:35 +08:00
MdeModulePkg.dsc MdeModulePkg/NvmExpressPei: Add the NVME device PEI BlockIo support 2018-06-25 09:13:12 +08:00
MdeModulePkg.uni MdeModulePkg/Variable/RuntimeDxe: introduce PcdMaxVolatileVariableSize 2018-03-30 21:17:07 +02:00
MdeModulePkgExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00