Source-Changes-HG archive

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

[src/trunk]: src/sys/net Add curlwp_bind to bridge_input for psref



details:   https://anonhg.NetBSD.org/src/rev/99345a828863
branches:  trunk
changeset: 826845:99345a828863
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Oct 02 07:40:24 2017 +0000

description:
Add curlwp_bind to bridge_input for psref

It can be called in a thread context via tap (tap_dev_write).

Fix PR kern/52587

diffstat:

 sys/net/if_bridge.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (70 lines):

diff -r 71ca32726703 -r 99345a828863 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Mon Oct 02 07:06:15 2017 +0000
+++ b/sys/net/if_bridge.c       Mon Oct 02 07:40:24 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.134 2017/03/07 01:53:53 ozaki-r Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.135 2017/10/02 07:40:24 ozaki-r Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.134 2017/03/07 01:53:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.135 2017/10/02 07:40:24 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -1792,6 +1792,7 @@
        struct bridge_iflist *bif;
        struct ether_header *eh;
        struct psref psref;
+       int bound;
        DECLARE_LOCK_VARIABLE;
 
        KASSERT(!cpu_intr_p());
@@ -1804,8 +1805,10 @@
                return;
        }
 
+       bound = curlwp_bind();
        bif = bridge_lookup_member_if(sc, ifp, &psref);
        if (bif == NULL) {
+               curlwp_bindx(bound);
                ACQUIRE_GLOBAL_LOCKS();
                ether_input(ifp, m);
                RELEASE_GLOBAL_LOCKS();
@@ -1857,6 +1860,7 @@
 
                if (_bif != NULL) {
                        bridge_release_member(sc, bif, &psref);
+                       curlwp_bindx(bound);
                        if (_ifp != NULL) {
                                m->m_flags &= ~M_PROMISC;
                                ACQUIRE_GLOBAL_LOCKS();
@@ -1873,6 +1877,7 @@
            memcmp(eh->ether_dhost, bstp_etheraddr, ETHER_ADDR_LEN) == 0) {
                bstp_input(sc, bif, m);
                bridge_release_member(sc, bif, &psref);
+               curlwp_bindx(bound);
                return;
        }
 
@@ -1882,6 +1887,7 @@
         */
        if (bstp_state_before_learning(bif)) {
                bridge_release_member(sc, bif, &psref);
+               curlwp_bindx(bound);
                ACQUIRE_GLOBAL_LOCKS();
                ether_input(ifp, m);
                RELEASE_GLOBAL_LOCKS();
@@ -1891,6 +1897,8 @@
        bridge_release_member(sc, bif, &psref);
 
        bridge_forward(sc, m);
+
+       curlwp_bindx(bound);
 }
 
 /*



Home | Main Index | Thread Index | Old Index