Skip to contentSkip to conversation

powerpc/pseries: Fix kernel crash caused by NULL PE

PATCH New Alexey Kardashevskiy 1 participant 1 message Nov 23, 2012 PowerPC

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 powerpc/pseries: Fix kernel crash caused by NULL PE

While hooking MSI interrupts, the corresponding device tree node of the PE that the PCI device has been put into should be checked. However, those PCI devices (e.g. VirtIO based PCI devices) that don't have EEH capability shouldn't have the associated PE. So we shouldn't try to get the PE's device tree node. Otherwise, it would cause kernel crash.

Actually, it was introduced by commit 66523d9f ("powerpc/eeh: Trace error based on PE from beginning").

---
 arch/powerpc/platforms/pseries/msi.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/msi.c +9 -1
index d19f497..9284e42 100644
@@ -218,9 +218,16 @@ static struct device_node *find_pe_dn(struct pci_dev *dev, int *total)
 	if (!dn)
 		return NULL;
 -	/* Get the top level device in the PE */
+	/*
+	 * Get the top level device in the PE, but some PCI devices
+	 * without EEH capability (e.g. VirtIO based PCI devices)
+	 * don't have the associated PE. So we should not get the
+	 * top level device from PE for those PCI devices.
+	 */
 	edev = of_node_to_eeh_dev(dn);
-	edev = list_first_entry(&edev->pe->edevs, struct eeh_dev, list);
+	if (edev->pe)
+		edev = list_first_entry(&edev->pe->edevs,
+				struct eeh_dev, list);
 	dn = eeh_dev_to_of_node(edev);
 	if (!dn)
 		return NULL;
Signature · 1 line
1.7.5.4