Skip to content

Commit 9a402cb

Browse files
leoliu-ocopsiff
authored andcommitted
PCI: Fix PCIe unplug Enumeration Long Blocking Issue
When a USB4 device is inserted, a PCIe tunnel will be established. Then, the PCIe hierarchy within the USB4 device will be enumerated. If the device is suddenly unplugged during the enumeration process, it is possible that the function pci_find_next_ext_capability called when the PCI driver scans the PCIe extended capability may take a very long time, perhaps more than 20 seconds. Signed-off-by: LeoLiu-oc <leoliu-oc@zhaoxin.com>
1 parent 585d92b commit 9a402cb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/pci/pci.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,6 +591,9 @@ u16 pci_find_next_ext_capability(struct pci_dev *dev, u16 start, int cap)
591591
return 0;
592592

593593
while (ttl-- > 0) {
594+
if (header == 0xffffffff)
595+
return 0;
596+
594597
if (PCI_EXT_CAP_ID(header) == cap && pos != start)
595598
return pos;
596599

0 commit comments

Comments
 (0)