Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 May 2009 11:05:24 +0000 (UTC)
From:      Bruce M Simpson <bms@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191718 - head/sys/netinet6
Message-ID:  <200905011105.n41B5OUY041307@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bms
Date: Fri May  1 11:05:24 2009
New Revision: 191718
URL: http://svn.freebsd.org/changeset/base/191718

Log:
  Limit scope of acquisition of INP_RLOCK for multicast input filter
  to the scope of its use, even though this may thrash the lock if
  the INP is referenced for other purposes.
  
  Tested by:	David Wolfskill

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Fri May  1 08:03:46 2009	(r191717)
+++ head/sys/netinet6/udp6_usrreq.c	Fri May  1 11:05:24 2009	(r191718)
@@ -279,8 +279,6 @@ udp6_input(struct mbuf **mp, int *offp, 
 					continue;
 			}
 
-			INP_RLOCK(inp);
-
 			/*
 			 * Handle socket delivery policy for any-source
 			 * and source-specific multicast. [RFC3678]
@@ -290,6 +288,8 @@ udp6_input(struct mbuf **mp, int *offp, 
 				struct sockaddr_in6	 mcaddr;
 				int			 blocked;
 
+				INP_RLOCK(inp);
+
 				bzero(&mcaddr, sizeof(struct sockaddr_in6));
 				mcaddr.sin6_len = sizeof(struct sockaddr_in6);
 				mcaddr.sin6_family = AF_INET6;
@@ -304,9 +304,11 @@ udp6_input(struct mbuf **mp, int *offp, 
 					if (blocked == MCAST_NOTSMEMBER ||
 					    blocked == MCAST_MUTED)
 						UDPSTAT_INC(udps_filtermcast);
-					INP_RUNLOCK(inp);
+					INP_RUNLOCK(inp); /* XXX */
 					continue;
 				}
+
+				INP_RUNLOCK(inp);
 			}
 			if (last != NULL) {
 				struct mbuf *n;
@@ -423,8 +425,6 @@ udp6_input(struct mbuf **mp, int *offp, 
 	return (IPPROTO_DONE);
 
 badheadlocked:
-	if (inp)
-		INP_RUNLOCK(inp);
 	INP_INFO_RUNLOCK(&V_udbinfo);
 badunlocked:
 	if (m)



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