summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-11-28 15:32:52 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-11-28 15:32:52 +0000
commitc0d4cb052d967ed0ae83b29eba3e2a4f44f9d3ce (patch)
treea3b3f40864b7442095f2096f091e2efee9e8836a /sys
parenta1a4a162b9f11bc819f2d766d3aeb5505107cb84 (diff)
Fix mbuf leak when an interface is destroyed while forwarding IPv6
packets. Found by Hrvoje Popovski. ok visa@, bluhm@
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet6/ip6_forward.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/netinet6/ip6_forward.c b/sys/netinet6/ip6_forward.c
index b2b6e46e2df..b254756a33b 100644
--- a/sys/netinet6/ip6_forward.c
+++ b/sys/netinet6/ip6_forward.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_forward.c,v 1.96 2017/11/21 12:05:09 mpi Exp $ */
+/* $OpenBSD: ip6_forward.c,v 1.97 2017/11/28 15:32:51 mpi Exp $ */
/* $KAME: ip6_forward.c,v 1.75 2001/06/29 12:42:13 jinmei Exp $ */
/*
@@ -240,8 +240,10 @@ reroute:
* modified by a redirect.
*/
ifp = if_get(rt->rt_ifidx);
- if (ifp == NULL)
+ if (ifp == NULL) {
+ m_freem(m);
goto freecopy;
+ }
if (rt->rt_ifidx == m->m_pkthdr.ph_ifidx && !srcrt &&
ip6_sendredirects &&
(rt->rt_flags & (RTF_DYNAMIC|RTF_MODIFIED)) == 0) {