Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 27 May 2016 17:31:02 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r300854 - in head/sys: netinet netinet6
Message-ID:  <201605271731.u4RHV2oW071581@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Fri May 27 17:31:02 2016
New Revision: 300854
URL: https://svnweb.freebsd.org/changeset/base/300854

Log:
  Plug route reference underleak that happens with FLOWTABLE after r297225.
  
  Submitted by:	Mike Karels <mike karels.net>

Modified:
  head/sys/netinet/ip_output.c
  head/sys/netinet6/ip6_output.c

Modified: head/sys/netinet/ip_output.c
==============================================================================
--- head/sys/netinet/ip_output.c	Fri May 27 17:07:07 2016	(r300853)
+++ head/sys/netinet/ip_output.c	Fri May 27 17:31:02 2016	(r300854)
@@ -701,7 +701,11 @@ sendit:
 		IPSTAT_INC(ips_fragmented);
 
 done:
-	if (ro == &iproute)
+	/*
+	 * Release the route if using our private route, or if
+	 * (with flowtable) we don't have our own reference.
+	 */
+	if (ro == &iproute || ro->ro_flags & RT_NORTREF)
 		RO_RTFREE(ro);
 	else if (rte == NULL)
 		/*

Modified: head/sys/netinet6/ip6_output.c
==============================================================================
--- head/sys/netinet6/ip6_output.c	Fri May 27 17:07:07 2016	(r300853)
+++ head/sys/netinet6/ip6_output.c	Fri May 27 17:31:02 2016	(r300854)
@@ -1053,7 +1053,11 @@ sendorfree:
 		IP6STAT_INC(ip6s_fragmented);
 
 done:
-	if (ro == &ip6route)
+	/*
+	 * Release the route if using our private route, or if
+	 * (with flowtable) we don't have our own reference.
+	 */
+	if (ro == &ip6route || ro->ro_flags & RT_NORTREF)
 		RO_RTFREE(ro);
 	return (error);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201605271731.u4RHV2oW071581>