Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jan 2020 16:15:44 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r356492 - in stable/12/sys: netinet netinet6
Message-ID:  <202001081615.008GFigA031221@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bz
Date: Wed Jan  8 16:15:43 2020
New Revision: 356492
URL: https://svnweb.freebsd.org/changeset/base/356492

Log:
  MFC r354092:
  
    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.

Modified:
  stable/12/sys/netinet/ip_reass.c
  stable/12/sys/netinet6/frag6.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/netinet/ip_reass.c
==============================================================================
--- stable/12/sys/netinet/ip_reass.c	Wed Jan  8 16:14:20 2020	(r356491)
+++ stable/12/sys/netinet/ip_reass.c	Wed Jan  8 16:15:43 2020	(r356492)
@@ -631,14 +631,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: stable/12/sys/netinet6/frag6.c
==============================================================================
--- stable/12/sys/netinet6/frag6.c	Wed Jan  8 16:14:20 2020	(r356491)
+++ stable/12/sys/netinet6/frag6.c	Wed Jan  8 16:15:43 2020	(r356492)
@@ -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?202001081615.008GFigA031221>