[PATCH] fix add notifier crashes

John Rose johnrose at austin.ibm.com
Thu Nov 3 03:29:55 EST 2005


Hi Paul-

The extraction of PCI stuff from struct device_node left some false
assumptions in notifier code.  As a result, dynamic add crashes when
non-PCI nodes are added.  This patch fixes these assumptions.

Thanks-
John

Signed-off-by: John Rose <johnrose at austin.ibm.com>

diff -puN arch/ppc64/kernel/pci_dn.c~add_crash_fix arch/ppc64/kernel/pci_dn.c
--- 2_6_linus_2/arch/ppc64/kernel/pci_dn.c~add_crash_fix	2005-10-31 10:51:19.000000000 -0600
+++ 2_6_linus_2-johnrose/arch/ppc64/kernel/pci_dn.c	2005-10-31 10:56:47.000000000 -0600
@@ -181,13 +181,14 @@ EXPORT_SYMBOL(fetch_dev_dn);
 static int pci_dn_reconfig_notifier(struct notifier_block *nb, unsigned long action, void *node)
 {
 	struct device_node *np = node;
-	struct pci_dn *pci;
+	struct pci_dn *pci = NULL;
 	int err = NOTIFY_OK;
 
 	switch (action) {
 	case PSERIES_RECONFIG_ADD:
 		pci = np->parent->data;
-		update_dn_pci_info(np, pci->phb);
+		if (pci)
+			update_dn_pci_info(np, pci->phb);
 		break;
 	default:
 		err = NOTIFY_DONE;
diff -puN arch/powerpc/platforms/pseries/iommu.c~add_crash_fix arch/powerpc/platforms/pseries/iommu.c
--- 2_6_linus_2/arch/powerpc/platforms/pseries/iommu.c~add_crash_fix	2005-10-31 15:19:14.000000000 -0600
+++ 2_6_linus_2-johnrose/arch/powerpc/platforms/pseries/iommu.c	2005-10-31 15:20:44.000000000 -0600
@@ -498,7 +498,7 @@ static int iommu_reconfig_notifier(struc
 
 	switch (action) {
 	case PSERIES_RECONFIG_REMOVE:
-		if (pci->iommu_table &&
+		if (pci && pci->iommu_table &&
 		    get_property(np, "ibm,dma-window", NULL))
 			iommu_free_table(np);
 		break;

_




More information about the Linuxppc64-dev mailing list