From 6dcec895d97f4a68b257e3683d638636602a3261 Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Sun, 13 Oct 2019 15:15:09 +0000 Subject: [PATCH] vlan_config() isn't always called in epoch context. Reported by: kp --- sys/net/if_vlan.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index 2f6aa69ca000..e69cc49f9244 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -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, uint16_t vid) 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;