summaryrefslogtreecommitdiff
path: root/sys/net/if_tun.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2015-09-10 17:41:16 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2015-09-10 17:41:16 +0000
commitebc7ce9e5c64c6d8611ada6e67026a561d0b15f0 (patch)
tree00af9163a24cdac0b3e918adc18f77b5f838383f /sys/net/if_tun.c
parent89e6bea9d139879cc2766c3fce8c04e73f58277f (diff)
dont leak an ifp reference if tun isnt ready to read.
found by jsg@
Diffstat (limited to 'sys/net/if_tun.c')
-rw-r--r--sys/net/if_tun.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index ba8bb3a4c48..7d317ea12e2 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tun.c,v 1.154 2015/09/09 20:18:03 dlg Exp $ */
+/* $OpenBSD: if_tun.c,v 1.155 2015/09/10 17:41:15 dlg Exp $ */
/* $NetBSD: if_tun.c,v 1.24 1996/05/07 02:40:48 thorpej Exp $ */
/*
@@ -734,6 +734,7 @@ tunread(dev_t dev, struct uio *uio, int ioflag)
TUNDEBUG(("%s: read\n", ifp->if_xname));
if ((tp->tun_flags & TUN_READY) != TUN_READY) {
TUNDEBUG(("%s: not ready %#x\n", ifp->if_xname, tp->tun_flags));
+ if_put(ifp);
return (EHOSTDOWN);
}