diff options
author | Roland Dreier <rolandd@cisco.com> | 2006-02-11 15:22:12 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-02-11 15:22:12 -0500 |
commit | 20b83382d1c5d4d1a73fc5671261db5239d1dbb3 (patch) | |
tree | 331685789ab2d86b1e126b0eb7c997642150d5d8 /drivers | |
parent | f295c79b6766b25fe8c1aad88211c54d1caa7e0b (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c index 932bf139a65d..a2408d7ec598 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_multicast.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_multicast.c | |||
@@ -533,8 +533,10 @@ void ipoib_mcast_join_task(void *dev_ptr) | |||
533 | } | 533 | } |
534 | 534 | ||
535 | if (!priv->broadcast) { | 535 | if (!priv->broadcast) { |
536 | priv->broadcast = ipoib_mcast_alloc(dev, 1); | 536 | struct ipoib_mcast *broadcast; |
537 | if (!priv->broadcast) { | 537 | |
538 | broadcast = ipoib_mcast_alloc(dev, 1); | ||
539 | if (!broadcast) { | ||
538 | ipoib_warn(priv, "failed to allocate broadcast group\n"); | 540 | ipoib_warn(priv, "failed to allocate broadcast group\n"); |
539 | mutex_lock(&mcast_mutex); | 541 | mutex_lock(&mcast_mutex); |
540 | if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) | 542 | if (test_bit(IPOIB_MCAST_RUN, &priv->flags)) |
@@ -544,10 +546,11 @@ void ipoib_mcast_join_task(void *dev_ptr) | |||
544 | return; | 546 | return; |
545 | } | 547 | } |
546 | 548 | ||
547 | memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4, | 549 | spin_lock_irq(&priv->lock); |
550 | memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4, | ||
548 | sizeof (union ib_gid)); | 551 | sizeof (union ib_gid)); |
552 | priv->broadcast = broadcast; | ||
549 | 553 | ||
550 | spin_lock_irq(&priv->lock); | ||
551 | __ipoib_mcast_add(dev, priv->broadcast); | 554 | __ipoib_mcast_add(dev, priv->broadcast); |
552 | spin_unlock_irq(&priv->lock); | 555 | spin_unlock_irq(&priv->lock); |
553 | } | 556 | } |
@@ -701,7 +704,9 @@ void ipoib_mcast_send(struct net_device *dev, union ib_gid *mgid, | |||
701 | */ | 704 | */ |
702 | spin_lock(&priv->lock); | 705 | spin_lock(&priv->lock); |
703 | 706 | ||
704 | if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || !priv->broadcast) { | 707 | if (!test_bit(IPOIB_MCAST_STARTED, &priv->flags) || |
708 | !priv->broadcast || | ||
709 | !test_bit(IPOIB_MCAST_FLAG_ATTACHED, &priv->broadcast->flags)) { | ||
705 | ++priv->stats.tx_dropped; | 710 | ++priv->stats.tx_dropped; |
706 | dev_kfree_skb_any(skb); | 711 | dev_kfree_skb_any(skb); |
707 | goto unlock; | 712 | goto unlock; |