From c6b2d024d7eedbf32f52a17bc029c92f5a4d1a54 Mon Sep 17 00:00:00 2001 From: "George V. Neville-Neil" Date: Mon, 21 Jun 2021 10:46:20 -0400 Subject: [PATCH] Retore the vnet before returning an error. Obtained from: Kanndula, Dheeraj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D30741 --- sys/net/if_vlan.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/net/if_vlan.c b/sys/net/if_vlan.c index bd3a5335a97..39f767c2a60 100644 --- a/sys/net/if_vlan.c +++ b/sys/net/if_vlan.c @@ -609,6 +609,7 @@ vlan_setmulti(struct ifnet *ifp) mc = malloc(sizeof(struct vlan_mc_entry), M_VLAN, M_NOWAIT); if (mc == NULL) { IF_ADDR_WUNLOCK(ifp); + CURVNET_RESTORE(); return (ENOMEM); } bcopy(ifma->ifma_addr, &mc->mc_addr, ifma->ifma_addr->sa_len); @@ -619,8 +620,10 @@ vlan_setmulti(struct ifnet *ifp) CK_SLIST_FOREACH (mc, &sc->vlan_mc_listhead, mc_entries) { error = if_addmulti(ifp_p, (struct sockaddr *)&mc->mc_addr, NULL); - if (error) + if (error) { + CURVNET_RESTORE(); return (error); + } } CURVNET_RESTORE();