Module Name:    src
Committed By:   maya
Date:           Sun Jan 29 18:30:33 UTC 2017

Modified Files:
        src/sys/net: if_tun.c

Log Message:
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


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/net/if_tun.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_tun.c
diff -u src/sys/net/if_tun.c:1.137 src/sys/net/if_tun.c:1.138
--- src/sys/net/if_tun.c:1.137	Thu Jan 26 21:38:11 2017
+++ src/sys/net/if_tun.c	Sun Jan 29 18:30:33 2017
@@ -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 <j...@cs.nott.ac.uk>
@@ -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 @@ tun_output(struct ifnet *ifp, struct mbu
 		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 @@ tun_output(struct ifnet *ifp, struct mbu
 		softint_schedule(tp->tun_isih);
 
 	selnotify(&tp->tun_rsel, 0, 0);
-out:
-	mutex_exit(&tp->tun_lock);
 
+	mutex_exit(&tp->tun_lock);
+out:
 	if (error && m0) {
 		m_freem(m0);
 	}

Reply via email to