From: erictian Date: Fri, 10 May 2013 05:19:30 +0000 (+0000) Subject: MdeMdeModulePkg/UsbBusDxe: Break device enumeration process if the device descriptor... X-Git-Tag: edk2-stable201903~12559 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=70eca31be15bf93072641b8dccaa9de22af2d5f2 MdeMdeModulePkg/UsbBusDxe: Break device enumeration process if the device descriptor includes 0 configuration. Signed-off-by: Feng Tian Reviewed-by: Mike Wu git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14338 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c index 35cdaf5527..1713e3c421 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c +++ b/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbDesc.c @@ -786,10 +786,13 @@ UsbBuildDescTable ( return Status; } - DevDesc = UsbDev->DevDesc; - NumConfig = DevDesc->Desc.NumConfigurations; - DevDesc->Configs = AllocateZeroPool (NumConfig * sizeof (USB_CONFIG_DESC *)); + DevDesc = UsbDev->DevDesc; + NumConfig = DevDesc->Desc.NumConfigurations; + if (NumConfig == 0) { + return EFI_DEVICE_ERROR; + } + DevDesc->Configs = AllocateZeroPool (NumConfig * sizeof (USB_CONFIG_DESC *)); if (DevDesc->Configs == NULL) { return EFI_OUT_OF_RESOURCES; }