Patchwork powerpc/iseries: fix possible null pointer dereference in iSeries_pcibios_fixup_resources

login
register
mail settings
Submitter Denis Kirjanov
Date June 16, 2010, 3:16 p.m.
Message ID <20100616151659.GA17669@hera.kernel.org>
Download mbox | patch
Permalink /patch/55895/
State Accepted, archived
Commit 18fa5c0a46df0fe7dfa72cb8d29f0ca1d0172a0f
Delegated to: Benjamin Herrenschmidt
Headers show

Comments

Denis Kirjanov - June 16, 2010, 3:16 p.m.
I don't know if this is a right fix for the problem
since of_get_property can return NULL.
Since iseries_device_information is used only for informational purpose,
we can skip this function without valid HvSubBusNumber number.

Signed-off-by: Denis Kirjanov <dkirjanov@kernel.org>
---
arch/powerpc/platforms/iseries/pci.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

Patch

diff --git a/arch/powerpc/platforms/iseries/pci.c b/arch/powerpc/platforms/iseries/pci.c
index 3fc2e64..ab3962b 100644
--- a/arch/powerpc/platforms/iseries/pci.c
+++ b/arch/powerpc/platforms/iseries/pci.c
@@ -445,7 +445,11 @@  void __init iSeries_pcibios_fixup_resources(struct pci_dev *pdev)
 	}
 
 	allocate_device_bars(pdev);
-	iseries_device_information(pdev, bus, *sub_bus);
+	if (likely(sub_bus))
+		iseries_device_information(pdev, bus, *sub_bus);
+	else
+		printk(KERN_ERR "PCI: Device node %s has missing or invalid "
+				"linux,subbus property\n", node->full_name);
 }
 
 /*