Module Name: src Committed By: yamaguchi Date: Fri Dec 24 04:50:40 UTC 2021
Modified Files: src/sys/net: if_vlan.c Log Message: Fix missing curlwp_bind() Fixes kern/56556 To generate a diff of this commit: cvs rdiff -u -r1.166 -r1.167 src/sys/net/if_vlan.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_vlan.c diff -u src/sys/net/if_vlan.c:1.166 src/sys/net/if_vlan.c:1.167 --- src/sys/net/if_vlan.c:1.166 Mon Dec 6 05:50:39 2021 +++ src/sys/net/if_vlan.c Fri Dec 24 04:50:40 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: if_vlan.c,v 1.166 2021/12/06 05:50:39 yamaguchi Exp $ */ +/* $NetBSD: if_vlan.c,v 1.167 2021/12/24 04:50:40 yamaguchi Exp $ */ /* * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc. @@ -78,7 +78,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.166 2021/12/06 05:50:39 yamaguchi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_vlan.c,v 1.167 2021/12/24 04:50:40 yamaguchi Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -1205,14 +1205,18 @@ vlan_start(struct ifnet *ifp) struct ifvlan_linkmib *mib; struct psref psref; struct ether_header *eh; - int error; + int error, bound; + bound = curlwp_bind(); mib = vlan_getref_linkmib(ifv, &psref); - if (mib == NULL) + if (mib == NULL) { + curlwp_bindx(bound); return; + } if (__predict_false(mib->ifvm_p == NULL)) { vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); return; } @@ -1354,6 +1358,7 @@ vlan_start(struct ifnet *ifp) /* Remove reference to mib before release */ vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); } static int @@ -1365,7 +1370,7 @@ vlan_transmit(struct ifnet *ifp, struct struct ifvlan_linkmib *mib; struct psref psref; struct ether_header *eh; - int error; + int error, bound; size_t pktlen = m->m_pkthdr.len; bool mcast = (m->m_flags & M_MCAST) != 0; @@ -1384,14 +1389,17 @@ vlan_transmit(struct ifnet *ifp, struct return EPROTONOSUPPORT; } + bound = curlwp_bind(); mib = vlan_getref_linkmib(ifv, &psref); if (mib == NULL) { + curlwp_bindx(bound); m_freem(m); return ENETDOWN; } if (__predict_false(mib->ifvm_p == NULL)) { vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); m_freem(m); return ENETDOWN; } @@ -1500,6 +1508,8 @@ vlan_transmit(struct ifnet *ifp, struct out: /* Remove reference to mib before release */ vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); + return error; } @@ -1623,13 +1633,18 @@ vlan_link_state_changed(void *xifv) struct ifnet *ifp, *p; struct ifvlan_linkmib *mib; struct psref psref; + int bound; + bound = curlwp_bind(); mib = vlan_getref_linkmib(ifv, &psref); - if (mib == NULL) + if (mib == NULL) { + curlwp_bindx(bound); return; + } if (mib->ifvm_p == NULL) { vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); return; } @@ -1638,6 +1653,7 @@ vlan_link_state_changed(void *xifv) if_link_state_change(ifp, p->if_link_state); vlan_putref_linkmib(mib, &psref); + curlwp_bindx(bound); } /*