svn commit: r300854 - in head/sys: netinet netinet6

Gleb Smirnoff glebius at FreeBSD.org
Fri May 27 17:31:03 UTC 2016


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);
 


More information about the svn-src-all mailing list