summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormpi <mpi@openbsd.org>2017-06-03 11:58:54 +0000
committermpi <mpi@openbsd.org>2017-06-03 11:58:54 +0000
commitceae12c823be5d5a5e7c53018f991d7206717bbb (patch)
tree373d6fad284742dc71cc1fc9b703fc17034e904e
parentExplicitly zero out the wepseed for TKIP and WEP. (diff)
downloadwireguard-openbsd-ceae12c823be5d5a5e7c53018f991d7206717bbb.tar.xz
wireguard-openbsd-ceae12c823be5d5a5e7c53018f991d7206717bbb.zip
Add missing NET_LOCK().
Found by jmc@
-rw-r--r--sys/net/if_tun.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index b672107791a..80eaabff78e 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.176 2017/05/30 16:16:47 deraadt Exp $ */
+/* $OpenBSD: if_tun.c,v 1.177 2017/06/03 11:58:54 mpi Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -837,7 +837,7 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int ioflag)
struct ifnet *ifp;
u_int32_t *th;
struct mbuf *top, **mp, *m;
- int error = 0, tlen;
+ int error = 0, tlen, s;
size_t mlen;
ifp = &tp->tun_if;
@@ -930,6 +930,8 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int ioflag)
ifp->if_ipackets++;
ifp->if_ibytes += top->m_pkthdr.len;
+ NET_LOCK(s);
+
switch (ntohl(*th)) {
case AF_INET:
ipv4_input(ifp, top);
@@ -941,9 +943,12 @@ tun_dev_write(struct tun_softc *tp, struct uio *uio, int ioflag)
#endif
default:
m_freem(top);
- return (EAFNOSUPPORT);
+ error = EAFNOSUPPORT;
+ break;
}
+ NET_UNLOCK(s);
+
return (error);
}