diff options
author | 2015-09-10 17:41:15 +0000 | |
---|---|---|
committer | 2015-09-10 17:41:15 +0000 | |
commit | 06b80873bf748b3f7651767342542f4edfefc8e1 (patch) | |
tree | c9dd348e06c543da731fdfd3c9366001d43cef2d | |
parent | if_put after if_get (diff) | |
download | wireguard-openbsd-06b80873bf748b3f7651767342542f4edfefc8e1.tar.xz wireguard-openbsd-06b80873bf748b3f7651767342542f4edfefc8e1.zip |
dont leak an ifp reference if tun isnt ready to read.
found by jsg@
-rw-r--r-- | sys/net/if_tun.c | 3 |
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); } |