summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorhselasky <hselasky@FreeBSD.org>2015-05-21 06:56:35 +0000
committerhselasky <hselasky@FreeBSD.org>2015-05-21 06:56:35 +0000
commit12519b3e4d2f63e3c5e8dea07cdb673d10215046 (patch)
tree597fcfa5573e0d7668da3b82898b61db5e97859a /sys
parentbaf0162e34b888f6d76595ac158d06d34336fec8 (diff)
downloadFreeBSD-src-12519b3e4d2f63e3c5e8dea07cdb673d10215046.zip
FreeBSD-src-12519b3e4d2f63e3c5e8dea07cdb673d10215046.tar.gz
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
Diffstat (limited to 'sys')
-rw-r--r--sys/ofed/drivers/net/mlx4/en_netdev.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/ofed/drivers/net/mlx4/en_netdev.c b/sys/ofed/drivers/net/mlx4/en_netdev.c
index 68ce125..5988c0d 100644
--- a/sys/ofed/drivers/net/mlx4/en_netdev.c
+++ b/sys/ofed/drivers/net/mlx4/en_netdev.c
@@ -650,6 +650,7 @@ static void mlx4_en_cache_mclist(struct net_device *dev)
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 net_device *dev)
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,
OpenPOWER on IntegriCloud