Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 May 2018 20:48:26 +0000 (UTC)
From:      Matt Macy <mmacy@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r333939 - head/sys/netinet6
Message-ID:  <201805202048.w4KKmQDk061615@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}



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