[openib-general] [PATCH]IPOIB: delete neigh from the list before kfree(neigh)

Shirley Ma xma at us.ibm.com
Thu Feb 24 10:19:06 PST 2005


Here is the patch against the most recent bit. Please review it. 

Signed-off-by: Shirley Ma <xma at us.ibm.com> 

diff -urpN infiniband/ulp/ipoib/ipoib_main.c 
infiniband-ah1/ulp/ipoib/ipoib_main.c
--- infiniband/ulp/ipoib/ipoib_main.c   2005-02-24 18:06:15.000000000 
+0000
+++ infiniband-ah1/ulp/ipoib/ipoib_main.c       2005-02-24 
18:18:12.000000000 +0000
@@ -225,16 +225,20 @@ static void __path_free(struct net_devic
                dev_kfree_skb_irq(skb);
 
        list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
-               if (neigh->ah)
+               if (neigh->ah) {
                        ipoib_put_ah(neigh->ah);
+                       neigh->bh = NULL;
+               }
+               list_del(&neigh->list);
                *to_ipoib_neigh(neigh->neighbour) = NULL;
                neigh->neighbour->ops->destructor = NULL;
                kfree(neigh);
        }
 
-       if (path->ah)
+       if (path->ah) {
                ipoib_put_ah(path->ah);
-
+               path->ah = NULL;
+       }
        rb_erase(&path->rb_node, &priv->path_tree);
        list_del(&path->list);
        kfree(path);
diff -urpN infiniband/ulp/ipoib/ipoib_multicast.c 
infiniband-ah1/ulp/ipoib/ipoib_multicast.c
--- infiniband/ulp/ipoib/ipoib_multicast.c      2005-02-24 
18:06:15.000000000 +0000
+++ infiniband-ah1/ulp/ipoib/ipoib_multicast.c  2005-02-24 
18:18:12.000000000 +0000
@@ -101,7 +101,11 @@ static void ipoib_mcast_free(struct ipoi
        spin_lock_irqsave(&priv->lock, flags);
 
        list_for_each_entry_safe(neigh, tmp, &mcast->neigh_list, list) {
-               ipoib_put_ah(neigh->ah);
+               if (neigh->ah) {
+                       ipoib_put_ah(neigh->ah);
+                       neigh->bh = NULL;
+               }
+               list_del(&neigh->list);
                *to_ipoib_neigh(neigh->neighbour) = NULL;
                neigh->neighbour->ops->destructor = NULL;
                kfree(neigh);
@@ -109,8 +113,10 @@ static void ipoib_mcast_free(struct ipoi
 
        spin_unlock_irqrestore(&priv->lock, flags);
 
-       if (mcast->ah)
+       if (mcast->ah) {
                ipoib_put_ah(mcast->ah);
+               mcast->ah = NULL;
+       }
 
        while (!skb_queue_empty(&mcast->pkt_queue)) {
                struct sk_buff *skb = skb_dequeue(&mcast->pkt_queue);




Thanks
Shirley Ma
IBM Linux Technology Center
15300 SW Koll Parkway
Beaverton, OR 97006-6063
Phone(Fax): (503) 578-7638

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050224/b6dff781/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: infiniband-ah1.patch
Type: application/octet-stream
Size: 1772 bytes
Desc: not available
URL: <http://lists.openfabrics.org/pipermail/general/attachments/20050224/b6dff781/attachment.obj>


More information about the general mailing list