IPoIB: Close race in setting mcast->ah
authorEli Cohen <eli@mellanox.co.il>
Tue, 28 Feb 2006 04:47:43 +0000 (20:47 -0800)
committerRoland Dreier <rolandd@cisco.com>
Mon, 20 Mar 2006 18:08:18 +0000 (10:08 -0800)
commit7343b231f22cec11f069bcdbb0c9a417df2750d3
tree3b72ba5f585fcab8271dc4be046b3bd447852847
parent1d89b1ae6c203bc68a3f424be144abcdf62773c9
IPoIB: Close race in setting mcast->ah

ipoib_mcast_send() tests mcast->ah twice.  If this value is changed
between these two points, we leak an skb.  However,
ipoib_mcast_join_finish() sets mcast->ah with no locking, so it could
race against ipoib_mcast_send().

As a solution, take priv->lock around assignment to mcast->ah thus
making sure ipoib_mcast_send() (which also takes priv->lock) is not in
flight.

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