Skip to contentSkip to conversation

i810-tco OOPS

PATCH Superseded Randy.Dunlap 1 participant 1 message Jul 11, 2001 Char and misc drivers

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i810-tco OOPS

Please apply to 2.4.7-preX and to 2.4.6-acX.

If one builds a kernel with the i810 tco watchdog driver but does not have this chipset, the i810tco_getdevice() function doesn't detect this and still calls pci_read_config_byte(), which promptly oopses...since the pci_for_each_dev() loop termination wasn't checked [i.e., <dev> is non-null after the loop whether the device was found or not].

Signature · 1 line
~Randy
drivers/char/i810-tco.c renamed from drivers/char/i810-tco.c.org +6 -1
@@ -256,14 +256,19 @@
 	struct pci_dev *dev;
 	u8 val1, val2;
 	u16 badr;
+	int found = 0;
 	/*
 	 *      Find the PCI device
 	 */
 
 	pci_for_each_dev(dev) {
-		if (pci_match_device(i810tco_pci_tbl, dev))
+		if (pci_match_device(i810tco_pci_tbl, dev)) {
+			found = 1;
 			break;
+		}
 	}
+	if (!found)
+		return 0;
 
 	if ((i810tco_pci = dev)) {
 		/*