]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[POWERPC] Fix possible NULL deref in ppc32 PCI
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Fri, 21 Dec 2007 03:53:27 +0000 (14:53 +1100)
committerPaul Mackerras <paulus@samba.org>
Fri, 21 Dec 2007 11:14:07 +0000 (22:14 +1100)
The 32-bit PCI code tests if "bus" is non-NULL after calling
pci_scan_bus_parented() in one place but not another before
dereferencing it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
arch/powerpc/kernel/pci_32.c

index 37cb7b9443195683821f55ba406a3b9e98be4364..a9c6cb24aab0c16f4165f7cfcf3389e4c1a826f0 100644 (file)
@@ -442,9 +442,10 @@ static int __init pcibios_init(void)
                hose->last_busno = 0xff;
                bus = pci_scan_bus_parented(hose->parent, hose->first_busno,
                                            hose->ops, hose);
-               if (bus)
+               if (bus) {
                        pci_bus_add_devices(bus);
-               hose->last_busno = bus->subordinate;
+                       hose->last_busno = bus->subordinate;
+               }
                if (pci_assign_all_buses || next_busno <= hose->last_busno)
                        next_busno = hose->last_busno + pcibios_assign_bus_offset;
        }