svn commit: r283179 - stable/9/sys/ofed/drivers/net/mlx4

Hans Petter Selasky hselasky at FreeBSD.org
Thu May 21 06:58:20 UTC 2015


Author: hselasky
Date: Thu May 21 06:58:19 2015
New Revision: 283179
URL: https://svnweb.freebsd.org/changeset/base/283179

Log:
  MFC r282817:
  Apply proper locking when iterating the multicast addresses and add a
  missing check for NULL from a non-blocking "kzalloc()" function call.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c
Directory Properties:
  stable/9/sys/   (props changed)

Modified: stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c
==============================================================================
--- stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c	Thu May 21 06:58:08 2015	(r283178)
+++ stable/9/sys/ofed/drivers/net/mlx4/en_netdev.c	Thu May 21 06:58:19 2015	(r283179)
@@ -650,6 +650,7 @@ static void mlx4_en_cache_mclist(struct 
 	struct mlx4_en_mc_list *tmp;
 	struct mlx4_en_priv *priv = netdev_priv(dev);
 
+        if_maddr_rlock(dev);
         TAILQ_FOREACH(ifma, &dev->if_multiaddrs, ifma_link) {
                 if (ifma->ifma_addr->sa_family != AF_LINK)
                         continue;
@@ -658,10 +659,13 @@ static void mlx4_en_cache_mclist(struct 
                         continue;
                 /* Make sure the list didn't grow. */
 		tmp = kzalloc(sizeof(struct mlx4_en_mc_list), GFP_ATOMIC);
+		if (tmp == NULL)
+			break;
 		memcpy(tmp->addr,
 			LLADDR((struct sockaddr_dl *)ifma->ifma_addr), ETH_ALEN);
 		list_add_tail(&tmp->list, &priv->mc_list);
         }
+        if_maddr_runlock(dev);
 }
 
 static void update_mclist_flags(struct mlx4_en_priv *priv,


More information about the svn-src-stable-9 mailing list