DragonFlyBSD Kernel Audit
DF-0991 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/bus/pci/pci.c b/sys/bus/pci/pci.c
--- a/sys/bus/pci/pci.c
+++ b/sys/bus/pci/pci.c
@@ -2898,7 +2898,8 @@
 	cparams = bus_read_4(res, EHCI_HCCPARAMS);
 
 	/* Synchronise with the BIOS if it owns the controller. */
-	for (eecp = EHCI_HCC_EECP(cparams); eecp != 0;
+	for (eecp = EHCI_HCC_EECP(cparams); eecp != 0 &&
+	    eecp < 256;
 	    eecp = EHCI_EECP_NEXT(eec)) {
 		eec = pci_read_config(self, eecp, 4);
 		if (EHCI_EECP_ID(eec) != EHCI_EC_LEGSUP) {