[openib-general] [PATCH repost] IB/ipoib: fix race reported by Eitan Rabin

Michael S. Tsirkin mst at mellanox.co.il
Mon Aug 7 02:27:11 PDT 2006


Please consider the following for 2.6.18.

Prevent flush task from freeing the ipoib_neigh pointer,
while ipoib_start_xmit is accessing the ipoib_neigh through
the pointer is has loaded from the hardware address.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index cf71d2a..31c4b05 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -336,7 +336,8 @@ void ipoib_flush_paths(struct net_device
 	struct ipoib_path *path, *tp;
 	LIST_HEAD(remove_list);
 
-	spin_lock_irq(&priv->lock);
+	spin_lock_irq(&priv->tx_lock);
+	spin_lock(&priv->lock);
 
 	list_splice(&priv->path_list, &remove_list);
 	INIT_LIST_HEAD(&priv->path_list);
@@ -352,7 +353,8 @@ void ipoib_flush_paths(struct net_device
 		path_free(dev, path);
 		spin_lock_irq(&priv->lock);
 	}
-	spin_unlock_irq(&priv->lock);
+	spin_unlock(&priv->lock);
+	spin_unlock_irq(&priv->tx_lock);
 }
 
 static void path_rec_completion(int status,


-- 
MST




More information about the general mailing list