[openib-general] [PATCH] ipoib_multicast: IPOIB_FLAG_ADMIN_UP test racy

Michael S. Tsirkin mst at mellanox.co.il
Wed Dec 7 05:11:05 PST 2005


Hello, Roland!
Here's a simple race scenario.

device is up.
port event triggers flush_task.
ipoib_ib_dev_flush (running from the default work queue)
calls ipoib_ib_dev_down.
This calls ipoib_mcast_stop_thread.
This flushes the ipoib workqueue.
mcast_task runs on ipoib workqueue, since IPOIB_FLAG_ADMIN_UP is set,
this re-starts the mcast task.

As a result mcast_task may be running while mcast_stop_thread
is scanning the multicast_list, or after that.

---

Fix race condition where mcast_task may be running after
ipoib_mcast_stop_thread has flushed the workqueue.

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

Index: linux-2.6.14/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- linux-2.6.14/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	(revision 4042)
+++ linux-2.6.14/drivers/infiniband/ulp/ipoib/ipoib_multicast.c	(working copy)
@@ -904,7 +904,7 @@
 		ipoib_mcast_free(mcast);
 	}
 
-	if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
+	if (test_bit(IPOIB_FLAG_OPER_UP, &priv->flags))
 		ipoib_mcast_start_thread(dev);
 }
 

-- 
MST



More information about the general mailing list