Skip to contentSkip to conversation

: ppc64/pseries: null iommu dma-window property.

PATCH New Linas Vepstas 1 participant 1 message Apr 10, 2007 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 : ppc64/pseries: null iommu dma-window property.

Paul,
Plese apply.

--linas

Some versions of pSeries firmware fail to set up a dma-window property for PCI slots that are unoccupied. As a result, the loop searching for this propery, in pci_dma_dev_setup_pSeriesLP(), can run to the end, resulting in a NULL pointer dereference later in the routine. This patch prevents the crash, and prints a warning message.

This is theoretically a rare error, as it occurs on what is hopefully just beta levels of firmware. But just in case this firmware escapes into the wild, this patch will avoid the crash.

----

 arch/powerpc/platforms/pseries/iommu.c |    6 ++++++
 1 file changed, 6 insertions(+)
arch/powerpc/platforms/pseries/iommu.c +6 -0
Index: linux-2.6.21-rc4-git4/arch/powerpc/platforms/pseries/iommu.c
===================================================================
@@ -526,6 +526,12 @@ static void pci_dma_dev_setup_pSeriesLP(
 			break;
 	}
 
+	if (!pdn || !PCI_DN(pdn)) {
+		printk(KERN_WARNING "pci_dma_dev_setup_pSeriesLP: "
+		       "no DMA window found for pci dev=%s dn=%s\n",
+				 pci_name(dev), dn? dn->full_name : "<null>");
+		return;
+	}
 	DBG("  parent is %s\n", pdn->full_name);
 
 	/* Check for parent == NULL so we don't try to setup the empty EADS