From: Michael S. Tsirkin <mst@mellanox.co.il>
Date: Mon, 12 Sep 2005 16:52:28 +0000 (-0700)
Subject: [PATCH] IPoIB: fix module removal race
X-Git-Tag: v2.6.14-rc3~150^2~9
X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=51574e0398a2d93cbf7f26e36b673cd919062268;p=linux-2.6-omap-h63xx.git

[PATCH] IPoIB: fix module removal race

Since ipoib uses queue_delayed_work to run flush task on port state events,
it must flush scheduled work after unregistering the event handler.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
---

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 49d120d2b92..704f48e0b6a 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -1005,6 +1005,7 @@ debug_failed:
 
 register_failed:
 	ib_unregister_event_handler(&priv->event_handler);
+	flush_scheduled_work();
 
 event_failed:
 	ipoib_dev_cleanup(priv->dev);
@@ -1057,6 +1058,7 @@ static void ipoib_remove_one(struct ib_device *device)
 
 	list_for_each_entry_safe(priv, tmp, dev_list, list) {
 		ib_unregister_event_handler(&priv->event_handler);
+		flush_scheduled_work();
 
 		unregister_netdev(priv->dev);
 		ipoib_dev_cleanup(priv->dev);