Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Oct 2019 18:54:06 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r354092 - in head/sys: netinet netinet6
Message-ID:  <201910251854.x9PIs6Vf047467@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Fri Oct 25 18:54:06 2019
New Revision: 354092
URL: https://svnweb.freebsd.org/changeset/base/354092

Log:
  Properly set VNET when nuking recvif from fragment queues.
  
  In theory the eventhandler invoke should be in the same VNET as
  the the current interface. We however cannot guarantee that for
  all cases in the future.
  
  So before checking if the fragmentation handling for this VNET
  is active, switch the VNET to the VNET of the interface to always
  get the one we want.
  
  Reviewed by:	hselasky
  MFC after:	3 weeks
  Sponsored by:	Netflix
  Differential Revision:	https://reviews.freebsd.org/D22153

Modified:
  head/sys/netinet/ip_reass.c
  head/sys/netinet6/frag6.c

Modified: head/sys/netinet/ip_reass.c
==============================================================================
--- head/sys/netinet/ip_reass.c	Fri Oct 25 18:46:53 2019	(r354091)
+++ head/sys/netinet/ip_reass.c	Fri Oct 25 18:54:06 2019	(r354092)
@@ -632,14 +632,17 @@ ipreass_cleanup(void *arg __unused, struct ifnet *ifp)
 
 	KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
 
+	CURVNET_SET_QUIET(ifp->if_vnet);
+
 	/*
 	 * Skip processing if IPv4 reassembly is not initialised or
 	 * torn down by ipreass_destroy().
 	 */ 
-	if (V_ipq_zone == NULL)
+	if (V_ipq_zone == NULL) {
+		CURVNET_RESTORE();
 		return;
+	}
 
-	CURVNET_SET_QUIET(ifp->if_vnet);
 	for (i = 0; i < IPREASS_NHASH; i++) {
 		IPQ_LOCK(i);
 		/* Scan fragment list. */

Modified: head/sys/netinet6/frag6.c
==============================================================================
--- head/sys/netinet6/frag6.c	Fri Oct 25 18:46:53 2019	(r354091)
+++ head/sys/netinet6/frag6.c	Fri Oct 25 18:54:06 2019	(r354092)
@@ -307,16 +307,18 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp)
 
 	KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__));
 
+	CURVNET_SET_QUIET(ifp->if_vnet);
 #ifdef VIMAGE
 	/*
 	 * Skip processing if IPv6 reassembly is not initialised or
 	 * torn down by frag6_destroy().
 	 */
-	if (!V_frag6_on)
+	if (!V_frag6_on) {
+		CURVNET_RESTORE();
 		return;
+	}
 #endif
 
-	CURVNET_SET_QUIET(ifp->if_vnet);
 	for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) {
 		IP6QB_LOCK(bucket);
 		head = IP6QB_HEAD(bucket);



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