Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Oct 2019 15:15:09 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r353467 - head/sys/net
Message-ID:  <201910131515.x9DFF9It040916@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Sun Oct 13 15:15:09 2019
New Revision: 353467
URL: https://svnweb.freebsd.org/changeset/base/353467

Log:
  vlan_config() isn't always called in epoch context.
  
  Reported by:	kp

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==============================================================================
--- head/sys/net/if_vlan.c	Sun Oct 13 09:35:03 2019	(r353466)
+++ head/sys/net/if_vlan.c	Sun Oct 13 15:15:09 2019	(r353467)
@@ -1346,12 +1346,11 @@ vlan_lladdr_fn(void *arg, int pending __unused)
 static int
 vlan_config(struct ifvlan *ifv, struct ifnet *p, uint16_t vid)
 {
+	struct epoch_tracker et;
 	struct ifvlantrunk *trunk;
 	struct ifnet *ifp;
 	int error = 0;
 
-	NET_EPOCH_ASSERT();
-
 	/*
 	 * We can handle non-ethernet hardware types as long as
 	 * they handle the tagging and headers themselves.
@@ -1452,7 +1451,9 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1
 
 	ifp->if_link_state = p->if_link_state;
 
+	NET_EPOCH_ENTER(et);
 	vlan_capabilities(ifv);
+	NET_EPOCH_EXIT(et);
 
 	/*
 	 * Set up our interface address to reflect the underlying
@@ -1794,8 +1795,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 	struct vlanreq vlr;
 	int error = 0;
 
-	NET_EPOCH_ASSERT();
-
 	ifr = (struct ifreq *)data;
 	ifa = (struct ifaddr *) data;
 	ifv = ifp->if_softc;
@@ -1972,8 +1971,13 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data
 		VLAN_SLOCK();
 		ifv->ifv_capenable = ifr->ifr_reqcap;
 		trunk = TRUNK(ifv);
-		if (trunk != NULL)
+		if (trunk != NULL) {
+			struct epoch_tracker et;
+
+			NET_EPOCH_ENTER(et);
 			vlan_capabilities(ifv);
+			NET_EPOCH_EXIT(et);
+		}
 		VLAN_SUNLOCK();
 		break;
 



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