[openib-general] [PATCH] ipoib: mcast allocation error handling

Michael S. Tsirkin mst at mellanox.co.il
Sun Dec 18 04:07:25 PST 2005


Here's a patch for a potential memory leak in ipoib.

BTW, given that mcast group allocations are done here with GFP_ATOMIC,
dont we want to do something safer than just print a warning if they fail?

---


Warn, and dont leak memory, on allocation failure for broadcast mcast group.

Signed-off-by: Eli Cohen <eli at mellanox.co.il>
Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: latest/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
===================================================================
--- latest.orig/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
+++ latest/drivers/infiniband/ulp/ipoib/ipoib_multicast.c
@@ -795,9 +796,11 @@ void ipoib_mcast_dev_flush(struct net_de
 					&priv->multicast_tree);
 
 			list_add_tail(&priv->broadcast->list, &remove_list);
-		}
-
-		priv->broadcast = nmcast;
+			priv->broadcast = nmcast;
+		} else
+			ipoib_warn(priv, "could not reallocate broadcast group "
+                        	          IPOIB_GID_FMT "\n",
+                                	  IPOIB_GID_ARG(priv->broadcast->mcmember.mgid));
 	}
 
 	spin_unlock_irqrestore(&priv->lock, flags);

-- 
MST



More information about the general mailing list