]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
IB/ipath: fix NULL dereference during cleanup
authorBryan O'Sullivan <bos@pathscale.com>
Tue, 23 May 2006 18:32:33 +0000 (11:32 -0700)
committerRoland Dreier <rolandd@cisco.com>
Tue, 23 May 2006 20:27:06 +0000 (13:27 -0700)
Fix NULL deref due to pcidev being clobbered before dd->ipath_f_cleanup()
was called.

Signed-off-by: Bryan O'Sullivan <bos@pathscale.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/hw/ipath/ipath_driver.c

index 3697edafd6d25f7caf05fe202e92cf7f591cb34c..dddcdae736ac89151d659a65e8521e98523890fb 100644 (file)
@@ -1905,19 +1905,19 @@ static void __exit infinipath_cleanup(void)
                        } else
                                ipath_dbg("irq is 0, not doing free_irq "
                                          "for unit %u\n", dd->ipath_unit);
-                       dd->pcidev = NULL;
-               }
 
-               /*
-                * we check for NULL here, because it's outside the kregbase
-                * check, and we need to call it after the free_irq.  Thus
-                * it's possible that the function pointers were never
-                * initialized.
-                */
-               if (dd->ipath_f_cleanup)
-                       /* clean up chip-specific stuff */
-                       dd->ipath_f_cleanup(dd);
+                       /*
+                        * we check for NULL here, because it's outside
+                        * the kregbase check, and we need to call it
+                        * after the free_irq.  Thus it's possible that
+                        * the function pointers were never initialized.
+                        */
+                       if (dd->ipath_f_cleanup)
+                               /* clean up chip-specific stuff */
+                               dd->ipath_f_cleanup(dd);
 
+                       dd->pcidev = NULL;
+               }
                spin_lock_irqsave(&ipath_devs_lock, flags);
        }