Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Fix missing curlwp_bind()



details:   https://anonhg.NetBSD.org/src/rev/01a8f4911b12
branches:  trunk
changeset: 1029156:01a8f4911b12
user:      yamaguchi <yamaguchi%NetBSD.org@localhost>
date:      Fri Dec 24 04:50:40 2021 +0000

description:
Fix missing curlwp_bind()

Fixes kern/56556

diffstat:

 sys/net/if_vlan.c |  28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diffs (111 lines):

diff -r ae89f03fb27d -r 01a8f4911b12 sys/net/if_vlan.c
--- a/sys/net/if_vlan.c Fri Dec 24 00:27:22 2021 +0000
+++ b/sys/net/if_vlan.c Fri Dec 24 04:50:40 2021 +0000
@@ -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 @@
        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 @@
 
        /* Remove reference to mib before release */
        vlan_putref_linkmib(mib, &psref);
+       curlwp_bindx(bound);
 }
 
 static int
@@ -1365,7 +1370,7 @@
        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 @@
                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 @@
 out:
        /* Remove reference to mib before release */
        vlan_putref_linkmib(mib, &psref);
+       curlwp_bindx(bound);
+
        return error;
 }
 
@@ -1623,13 +1633,18 @@
        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 @@
        if_link_state_change(ifp, p->if_link_state);
 
        vlan_putref_linkmib(mib, &psref);
+       curlwp_bindx(bound);
 }
 
 /*



Home | Main Index | Thread Index | Old Index