Skip to content

Commit 966c587

Browse files
xiaoguangwuwenlingz
authored andcommitted
DM USB: xHCI: fix potential NULL pointer issue.
During S3 process, the dev in the function pci_xhci_device_doorbell may be set to NULL when disconnection is detected by DM. This patch is used to remove this risk. 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>
1 parent 5b39fd0 commit 966c587

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

devicemodel/hw/pci/xhci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2937,6 +2937,9 @@ pci_xhci_device_doorbell(struct pci_xhci_vdev *xdev,
29372937
}
29382938

29392939
dev = XHCI_SLOTDEV_PTR(xdev, slot);
2940+
if (!dev)
2941+
return;
2942+
29402943
devep = &dev->eps[epid];
29412944
dev_ctx = pci_xhci_get_dev_ctx(xdev, slot);
29422945
if (!dev_ctx)

0 commit comments

Comments
 (0)