powerpc/iseries: Fix possible null pointer dereference in iSeries_pcibios_fixup_resources
authorDenis Kirjanov <dkirjanov@hera.kernel.org>
Wed, 16 Jun 2010 05:16:59 +0000 (05:16 +0000)
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>
Thu, 8 Jul 2010 08:11:43 +0000 (18:11 +1000)
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>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
arch/powerpc/platforms/iseries/pci.c

index 3fc2e6494b8b277cf01eb0d03c76e69bc1f11664..ab3962b0d246b586f9b406769acd9e39cd712482 100644 (file)
@@ -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);
 }
 
 /*