DM: xHCI: Add Null pointer check in Set TR Dequeue command

Add Null pointer check in Set TR Dequeue command handle function
 to avoid Null pointer exception. Fllow xHCI spec 4.6.10, for Set
 TR Dequeue pointer command, when the slot is not enabled the
 completion code should be Slot Not Enabled Error.

Tracked-On: #5263
Signed-off-by: Long Liu <long.liu@intel.com>
Acked-by: Yu Wang yu1.wang@intel.com
This commit is contained in:
Liu Long 2020-09-01 13:32:35 +08:00 committed by wenlingz
parent b66e8797fa
commit c2d85b13d6
1 changed files with 5 additions and 0 deletions

View File

@ -2423,6 +2423,11 @@ pci_xhci_cmd_set_tr(struct pci_xhci_vdev *xdev,
cmderr = XHCI_TRB_ERROR_SUCCESS; cmderr = XHCI_TRB_ERROR_SUCCESS;
dev = XHCI_SLOTDEV_PTR(xdev, slot); dev = XHCI_SLOTDEV_PTR(xdev, slot);
if (!dev) {
UPRINTF(LDBG, "%s slot is not enabled!\r\n", __func__);
cmderr = XHCI_TRB_ERROR_SLOT_NOT_ON;
goto done;
}
UPRINTF(LDBG, "set_tr: new-tr x%016lx, SCT %u DCS %u\r\n" UPRINTF(LDBG, "set_tr: new-tr x%016lx, SCT %u DCS %u\r\n"
" stream-id %u, slot %u, epid %u, C %u\r\n", " stream-id %u, slot %u, epid %u, C %u\r\n",
(trb->qwTrb0 & ~0xF), (uint32_t)((trb->qwTrb0 >> 1) & 0x7), (trb->qwTrb0 & ~0xF), (uint32_t)((trb->qwTrb0 >> 1) & 0x7),