Skip to contentSkip to conversation

powerpc: Extra sanity check in EEH code

PATCH In review Anton Blanchard 2 participants 2 messages Jun 20, 2006 – Jun 23, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc: Extra sanity check in EEH code

From: Nathan Lynch <[email protected]>

Don't dereference a device node that isn't there. A "shouldn't happen" case, but someone ran into it with a possibly misconfigured device tree.

---

arch/powerpc/platforms/pseries/eeh_cache.c +2 -0
Index: build/arch/powerpc/platforms/pseries/eeh_cache.c
===================================================================
@@ -304,6 +304,8 @@ void __init pci_addr_cache_build(void)
 		pci_addr_cache_insert_device(dev);
 
 		dn = pci_device_to_OF_node(dev);
+		if (!dn)
+			continue;
 		pci_dev_get (dev);  /* matching put is in eeh_remove_device() */
 		PCI_DN(dn)->pcidev = dev;
 	}
#1 lore raw

As nominal maintainer of the EEH code, I'll add

Quoted 24 lines · Anton Blanchard

From: Nathan Lynch <[email protected]>

Don't dereference a device node that isn't there. A "shouldn't happen" case, but someone ran into it with a possibly misconfigured device tree.

---

Index: build/arch/powerpc/platforms/pseries/eeh_cache.c
===================================================================

arch/powerpc/platforms/pseries/eeh_cache.c +2 -0
@@ -304,6 +304,8 @@ void __init pci_addr_cache_build(void)
 		pci_addr_cache_insert_device(dev);
 
 		dn = pci_device_to_OF_node(dev);
+		if (!dn)
+			continue;
 		pci_dev_get (dev);  /* matching put is in eeh_remove_device() */
 		PCI_DN(dn)->pcidev = dev;
 	}