Page MenuHomeFreeBSD

D60366.1795477399.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D60366.1795477399.diff

diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1566,9 +1566,14 @@
int cnt;
/*
- * Check the CAP_LIST bit of the PCI status register first.
+ * Check the CAP_LIST bit of the PCI status register first. An
+ * all-ones status is an unreachable device that would pass the
+ * CAP_LIST test, sending the walk below down a list of 0xff
+ * pointers with the bus topology locked.
*/
status = pci_read_config(child, PCIR_STATUS, 2);
+ if (status == 0xffff)
+ return (ENXIO);
if (!(status & PCIM_STATUS_CAPPRESENT))
return (ENXIO);
@@ -1593,8 +1598,11 @@
* Traverse the capabilities list. Limit by total theoretical
* maximum number of caps: capability needs at least id and
* next registers, and any type X header cannot contain caps.
+ * Stop on an all-ones pointer as well: it is not a valid
+ * capability offset.
*/
- for (cnt = 0; ptr != 0 && cnt < (PCIE_REGMAX - 0x40) / 2; cnt++) {
+ for (cnt = 0; ptr != 0 && ptr != 0xff &&
+ cnt < (PCIE_REGMAX - 0x40) / 2; cnt++) {
if (pci_read_config(child, ptr + PCICAP_ID, 1) == capability) {
if (capreg != NULL)
*capreg = ptr;

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 23, 11:43 PM (22 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40912378
Default Alt Text
D60366.1795477399.diff (1 KB)

Event Timeline