Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 Jul 2012 08:41:00 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238572 - head/sys/netinet
Message-ID:  <201207180841.q6I8f0WC046737@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Wed Jul 18 08:41:00 2012
New Revision: 238572
URL: http://svn.freebsd.org/changeset/base/238572

Log:
  When traversing global in_ifaddr list in the IFP_TO_IA() macro, we need
  to obtain IN_IFADDR_RLOCK().

Modified:
  head/sys/netinet/in_var.h

Modified: head/sys/netinet/in_var.h
==============================================================================
--- head/sys/netinet/in_var.h	Wed Jul 18 08:37:08 2012	(r238571)
+++ head/sys/netinet/in_var.h	Wed Jul 18 08:41:00 2012	(r238572)
@@ -161,14 +161,16 @@ do { \
 #define IFP_TO_IA(ifp, ia)						\
 	/* struct ifnet *ifp; */					\
 	/* struct in_ifaddr *ia; */					\
-{									\
+do {									\
+	IN_IFADDR_RLOCK();						\
 	for ((ia) = TAILQ_FIRST(&V_in_ifaddrhead);			\
 	    (ia) != NULL && (ia)->ia_ifp != (ifp);			\
 	    (ia) = TAILQ_NEXT((ia), ia_link))				\
 		continue;						\
 	if ((ia) != NULL)						\
 		ifa_ref(&(ia)->ia_ifa);					\
-}
+	IN_IFADDR_RUNLOCK();						\
+} while (0)
 #endif
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207180841.q6I8f0WC046737>