Source-Changes-HG archive

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

[src/trunk]: src/sys/net Most error paths that goto out; don't hold tun_lock.



details:   https://anonhg.NetBSD.org/src/rev/81255887e1f4
branches:  trunk
changeset: 821236:81255887e1f4
user:      maya <maya%NetBSD.org@localhost>
date:      Sun Jan 29 18:30:33 2017 +0000

description:
Most error paths that goto out; don't hold tun_lock.
so don't mutex_exit(tun_lock) in them, but only in
the one that needs it.

ok skrll

diffstat:

 sys/net/if_tun.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r bb769f2b3fed -r 81255887e1f4 sys/net/if_tun.c
--- a/sys/net/if_tun.c  Sun Jan 29 16:52:38 2017 +0000
+++ b/sys/net/if_tun.c  Sun Jan 29 18:30:33 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tun.c,v 1.137 2017/01/26 21:38:11 skrll Exp $       */
+/*     $NetBSD: if_tun.c,v 1.138 2017/01/29 18:30:33 maya Exp $        */
 
 /*
  * Copyright (c) 1988, Julian Onions <jpo%cs.nott.ac.uk@localhost>
@@ -19,7 +19,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.137 2017/01/26 21:38:11 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tun.c,v 1.138 2017/01/29 18:30:33 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -540,6 +540,7 @@
                TUNDEBUG ("%s: not ready 0%o\n", ifp->if_xname,
                          tp->tun_flags);
                error = EHOSTDOWN;
+               mutex_exit(&tp->tun_lock);
                goto out;
        }
        // XXXrmind
@@ -619,9 +620,9 @@
                softint_schedule(tp->tun_isih);
 
        selnotify(&tp->tun_rsel, 0, 0);
-out:
+
        mutex_exit(&tp->tun_lock);
-
+out:
        if (error && m0) {
                m_freem(m0);
        }



Home | Main Index | Thread Index | Old Index