svn commit: r333939 - head/sys/netinet6

Matt Macy mmacy at FreeBSD.org
Sun May 20 20:48:27 UTC 2018


Author: mmacy
Date: Sun May 20 20:48:26 2018
New Revision: 333939
URL: https://svnweb.freebsd.org/changeset/base/333939

Log:
  make sure vnet is set when freeing
  
  Reported by:	pho

Modified:
  head/sys/netinet6/in6_mcast.c

Modified: head/sys/netinet6/in6_mcast.c
==============================================================================
--- head/sys/netinet6/in6_mcast.c	Sun May 20 20:34:15 2018	(r333938)
+++ head/sys/netinet6/in6_mcast.c	Sun May 20 20:48:26 2018	(r333939)
@@ -1626,6 +1626,8 @@ inp_gcmoptions(epoch_context_t ctx)
 {
 	struct ip6_moptions *imo;
 	struct in6_mfilter	*imf;
+	struct in6_multi *inm;
+	struct ifnet *ifp;
 	size_t			 idx, nmships;
 
 	imo =  __containerof(ctx, struct ip6_moptions, imo6_epoch_ctx);
@@ -1635,8 +1637,13 @@ inp_gcmoptions(epoch_context_t ctx)
 		imf = imo->im6o_mfilters ? &imo->im6o_mfilters[idx] : NULL;
 		if (imf)
 			im6f_leave(imf);
-		/* XXX this will thrash the lock(s) */
-		(void)in6_leavegroup(imo->im6o_membership[idx], imf);
+		inm = imo->im6o_membership[idx];
+		ifp = inm->in6m_ifp;
+		if (ifp)
+			CURVNET_SET(ifp->if_vnet);
+		(void)in6_leavegroup(inm, imf);
+		if (ifp)
+			CURVNET_RESTORE();
 		if (imf)
 			im6f_purge(imf);
 	}


More information about the svn-src-head mailing list