IPoIB: Yet another fix for send-only joins
Even after the last fix, it's still possible for a send-only join to start before the join for the broadcast group has finished. This could cause us to create a multicast group using attributes from the broadcast group that haven't been initialized yet, so we would use garbage for the Q_Key, etc. Fix this by waiting until the broadcast group's attached flag is set before starting send-only joins. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
f295c79b67
commit
20b83382d1
1 changed files with 11 additions and 6 deletions
|
@ -533,8 +533,10 @@ void ipoib_mcast_join_task(void *dev_ptr)
|
|||
}
|
||||
|
||||
if (!priv->broadcast) {
|
||||
priv->broadcast = ipoib_mcast_alloc(dev, 1);
|
||||
if (!priv->broadcast) {
|
||||
struct ipoib_mcast *broadcast;
|
||||
|
||||
broadcast = ipoib_mcast_alloc(dev, 1);
|
||||
if (!broadcast) {
|
||||
ipoib_warn(priv, "failed to allocate broadcast group\n");
|
||||
mutex_lock(&mcast_mutex);
|
||||
if (test_bit(IPOIB_MCAST_RUN, &priv->flags))
|
||||
|
@ -544,10 +546,11 @@ void ipoib_mcast_join_task(void *dev_ptr)
|
|||
return;
|
||||
}
|
||||
|
||||
memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
|
||||
sizeof (union ib_gid));
|
||||
|
||||
spin_lock_irq(&priv->lock);
|
||||
memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
|
||||
sizeof (union ib_gid));
|
||||
priv->broadcast = broadcast;
|
||||
|
||||
__ipoib_mcast_add(dev, priv->broadcast);
|
||||
spin_unlock_irq(&priv->lock);
|
||||
}
|
||||
|
@ -701,7 +704,9 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid,
|
|||
*/
|
||||
spin_lock(&priv->lock);
|
||||
|
||||
if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || !priv->broadcast) {
|
||||
if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) ||
|
||||
!priv->broadcast ||
|
||||
!test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) {
|
||||
++priv->stats.tx_dropped;
|
||||
dev_kfree_skb_any(skb);
|
||||
goto unlock;
|
||||
|
|
Loading…
Reference in a new issue