From 31da3841140e188ef30c9fd0f46895f1cc0ac0a3 Mon Sep 17 00:00:00 2001 From: ozaki-r Date: Tue, 17 May 2016 03:24:46 +0000 Subject: [PATCH] Make sure icmp6_redirect_input frees mbuf before return --- sys/netinet6/icmp6.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 44b900237016..98c39606cfd7 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -1,4 +1,4 @@ -/* $NetBSD: icmp6.c,v 1.183 2016/05/12 02:24:17 ozaki-r Exp $ */ +/* $NetBSD: icmp6.c,v 1.184 2016/05/17 03:24:46 ozaki-r Exp $ */ /* $KAME: icmp6.c,v 1.217 2001/06/20 15:03:29 jinmei Exp $ */ /* @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.183 2016/05/12 02:24:17 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: icmp6.c,v 1.184 2016/05/17 03:24:46 ozaki-r Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -2140,8 +2140,8 @@ icmp6_redirect_input(struct mbuf *m, int off) struct in6_addr reddst6; union nd_opts ndopts; - if (!ifp) - return; + if (ifp == NULL) + goto freeit; /* XXX if we are router, we don't update route by icmp6 redirect */ if (ip6_forwarding) @@ -2277,7 +2277,7 @@ icmp6_redirect_input(struct mbuf *m, int off) if (0 <= ip6_maxdynroutes && rtcount >= ip6_maxdynroutes) goto freeit; if (0 <= icmp6_redirect_hiwat && rtcount > icmp6_redirect_hiwat) - return; + goto freeit; else if (0 <= icmp6_redirect_lowat && rtcount > icmp6_redirect_lowat) { /*