From owner-svn-src-stable@FreeBSD.ORG Sat Oct 30 11:54:55 2010 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7AE171065675; Sat, 30 Oct 2010 11:54:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 690F78FC12; Sat, 30 Oct 2010 11:54:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o9UBstps096076; Sat, 30 Oct 2010 11:54:55 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o9UBstRo096074; Sat, 30 Oct 2010 11:54:55 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201010301154.o9UBstRo096074@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sat, 30 Oct 2010 11:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r214552 - stable/8/sys/net X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 30 Oct 2010 11:54:55 -0000 Author: bz Date: Sat Oct 30 11:54:55 2010 New Revision: 214552 URL: http://svn.freebsd.org/changeset/base/214552 Log: MFC r213930: Close a race acquiring the IF_ADDR_LOCK() for each entry while iterating over all interfaces to make sure the address will neither change nor be freed while we are working on it. PR: kern/146250 Submitted by: Mikolaj Golub (to.my.trociny gmail.com) Modified: stable/8/sys/net/rtsock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Sat Oct 30 11:30:49 2010 (r214551) +++ stable/8/sys/net/rtsock.c Sat Oct 30 11:54:55 2010 (r214552) @@ -1473,6 +1473,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; + IF_ADDR_LOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1530,10 +1531,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } + IF_ADDR_UNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: + if (ifp != NULL) + IF_ADDR_UNLOCK(ifp); IFNET_RUNLOCK(); return (error); }