[PATCH 2/3] powerpc/eeh: Fix pci bridge handling bug
Linas Vepstas
linas at austin.ibm.com
Fri Jul 27 08:33:58 EST 2007
The EEH code needs to ignore PCI bridges; sort-of. It was ignoring
them in the wrong place, and thus failing to set up the
PCI_DN(dn)->pcidev pointer. Imprudent dereferencing of this pointer
would lead to a crash on cards with bridges.
Signed-off-by: Linas Vepstas <linas at austin.ibm.com>
----
arch/powerpc/platforms/pseries/eeh_cache.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
Index: linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh_cache.c
===================================================================
--- linux-2.6.22-git2.orig/arch/powerpc/platforms/pseries/eeh_cache.c 2007-07-25 13:10:03.000000000 -0500
+++ linux-2.6.22-git2/arch/powerpc/platforms/pseries/eeh_cache.c 2007-07-25 13:13:41.000000000 -0500
@@ -225,6 +225,10 @@ void pci_addr_cache_insert_device(struct
{
unsigned long flags;
+ /* Ignore PCI bridges */
+ if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
+ return;
+
spin_lock_irqsave(&pci_io_addr_cache_root.piar_lock, flags);
__pci_addr_cache_insert_device(dev);
spin_unlock_irqrestore(&pci_io_addr_cache_root.piar_lock, flags);
@@ -285,16 +289,13 @@ void __init pci_addr_cache_build(void)
spin_lock_init(&pci_io_addr_cache_root.piar_lock);
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
- /* Ignore PCI bridges */
- if ((dev->class >> 16) == PCI_BASE_CLASS_BRIDGE)
- continue;
pci_addr_cache_insert_device(dev);
dn = pci_device_to_OF_node(dev);
if (!dn)
continue;
- pci_dev_get (dev); /* matching put is in eeh_remove_device() */
+ pci_dev_get(dev); /* matching put is in eeh_remove_device() */
PCI_DN(dn)->pcidev = dev;
eeh_sysfs_add_device(dev);
More information about the Linuxppc-dev
mailing list