Quoting r. Roland Dreier <[EMAIL PROTECTED]>:
> Subject: Re: ipoib_mcast_send.patch
> 
>     Michael> I agree. Do you want to fix it or should I?
> 
> If you get a chance that would be great.  I'm at the OpenIB workshop
> now so I probably can't seriously look at it until tomorrow at the
> earliest.

Here you are. The following is in ipoib_broadcast_gid.patch in svn.

---

The way priv->broadcast is initialized in ipoib_mcast_join_task() is somewhat
unsafe, since there's no lock and conceivably a send-only join could complete
before priv->broadcast is fully set up.

Signed-off-by: Michael S. Tsirkin <[EMAIL PROTECTED]>

Index: openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c       (revision 5336)
+++ openib/drivers/infiniband/ulp/ipoib/ipoib_multicast.c       (working copy)
@@ -533,8 +533,9 @@ 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 +545,11 @@ void ipoib_mcast_join_task(void *dev_ptr
                        return;
                }
 
-               memcpy(priv->broadcast->mcmember.mgid.raw, priv->dev->broadcast 
+ 4,
+               spin_lock_irq(&priv->lock);
+               priv->broadcast = broadcast;
+               memcpy(broadcast->mcmember.mgid.raw, priv->dev->broadcast + 4,
                       sizeof (union ib_gid));
 
-               spin_lock_irq(&priv->lock);
                __ipoib_mcast_add(dev, priv->broadcast);
                spin_unlock_irq(&priv->lock);
        }

-- 
Michael S. Tsirkin
Staff Engineer, Mellanox Technologies
_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to