From owner-svn-src-head@FreeBSD.ORG Tue May 12 11:52:35 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A6507D17; Tue, 12 May 2015 11:52:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 9436F11D4; Tue, 12 May 2015 11:52:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4CBqZZB019743; Tue, 12 May 2015 11:52:35 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4CBqZ2E019742; Tue, 12 May 2015 11:52:35 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201505121152.t4CBqZ2E019742@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Tue, 12 May 2015 11:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282817 - head/sys/ofed/drivers/net/mlx4 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 11:52:35 -0000 Author: hselasky Date: Tue May 12 11:52:34 2015 New Revision: 282817 URL: https://svnweb.freebsd.org/changeset/base/282817 Log: Apply proper locking when iterating the multicast addresses and add a missing check for NULL from a non-blocking "kzalloc()" function call. MFC after: 1 week Sponsored by: Mellanox Technologies Found by: glebius @ Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c Modified: head/sys/ofed/drivers/net/mlx4/en_netdev.c ============================================================================== --- head/sys/ofed/drivers/net/mlx4/en_netdev.c Tue May 12 10:03:14 2015 (r282816) +++ head/sys/ofed/drivers/net/mlx4/en_netdev.c Tue May 12 11:52:34 2015 (r282817) @@ -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,