IPoIB: protect child list in ipoib_ib_dev_flush
authorMichael S. Tsirkin <mst@mellanox.co.il>
Tue, 29 Nov 2005 18:53:30 +0000 (10:53 -0800)
committerRoland Dreier <rolandd@cisco.com>
Tue, 29 Nov 2005 18:53:30 +0000 (10:53 -0800)
race condition: ipoib_ib_dev_flush is accessing child list without locks.

Signed-off-by: Michael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
drivers/infiniband/ulp/ipoib/ipoib_ib.c

index 54ef2fea530f8494ba71882b1c5b4b20f8ff169f..23885801b6d2b3efd1cfefc925b8b451eafceff9 100644 (file)
@@ -608,9 +608,13 @@ void ipoib_ib_dev_flush(void *_dev)
        if (test_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags))
                ipoib_ib_dev_up(dev);
 
+       down(&priv->vlan_mutex);
+
        /* Flush any child interfaces too */
        list_for_each_entry(cpriv, &priv->child_intfs, list)
                ipoib_ib_dev_flush(&cpriv->dev);
+
+       up(&priv->vlan_mutex);
 }
 
 void ipoib_ib_dev_cleanup(struct net_device *dev)