DM USB: xHCI: fix an issues for failing to enumerate device

This is an obvious bug, which releases memory but still access the
data on the released memory. It is risky operation, and may result
failing to do normal enumlation process. This patch is used to fix
it.

Tracked-On: #1893
Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
Reviewed-by: Liang Yang <liang3.yang@intel.com>
Acked-by: Yu Wang <yu1.wang@intel.com>
This commit is contained in:
Xiaoguang Wu 2018-12-14 19:15:56 +08:00 committed by wenlingz
parent 1c3344b782
commit d2627ecfcc
1 changed files with 3 additions and 2 deletions

View File

@ -1802,8 +1802,6 @@ pci_xhci_cmd_disable_slot(struct pci_xhci_vdev *xdev, uint32_t slot)
goto done;
}
pci_xhci_dev_destroy(dev);
for (j = 0; j < XHCI_MAX_VIRT_PORTS; ++j) {
path = &xdev->vbdp_devs[j].path;
@ -1818,6 +1816,9 @@ pci_xhci_cmd_disable_slot(struct pci_xhci_vdev *xdev, uint32_t slot)
}
UPRINTF(LINF, "disable slot %d for native device %d-%s\r\n",
slot, di->path.bus, usb_dev_path(&di->path));
/* release all the resource allocated for virtual device */
pci_xhci_dev_destroy(dev);
} else
UPRINTF(LWRN, "invalid slot %d\r\n", slot);