svn commit: r296259 - projects/vnet/sys/netinet

Bjoern A. Zeeb bz at FreeBSD.org
Tue Mar 1 10:29:08 UTC 2016


Author: bz
Date: Tue Mar  1 10:29:06 2016
New Revision: 296259
URL: https://svnweb.freebsd.org/changeset/base/296259

Log:
  We attach the "counter" to the tcpcbs.  Thus don't free the
  TCP Fastopen zone before the tcpcbs are gone, as otherwise
  the zone won't be empty.
  With that it should be safe to destroy the "tfo" zone without
  leaking the memory.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  projects/vnet/sys/netinet/tcp_fastopen.c
  projects/vnet/sys/netinet/tcp_subr.c

Modified: projects/vnet/sys/netinet/tcp_fastopen.c
==============================================================================
--- projects/vnet/sys/netinet/tcp_fastopen.c	Tue Mar  1 09:51:36 2016	(r296258)
+++ projects/vnet/sys/netinet/tcp_fastopen.c	Tue Mar  1 10:29:06 2016	(r296259)
@@ -204,7 +204,7 @@ void
 tcp_fastopen_init(void)
 {
 	V_counter_zone = uma_zcreate("tfo", sizeof(unsigned int),
-	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
+	    NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0);
 	rm_init(&V_tcp_fastopen_keylock, "tfo_keylock");
 	callout_init_rm(&V_tcp_fastopen_autokey_ctx.c,
 	    &V_tcp_fastopen_keylock, 0);

Modified: projects/vnet/sys/netinet/tcp_subr.c
==============================================================================
--- projects/vnet/sys/netinet/tcp_subr.c	Tue Mar  1 09:51:36 2016	(r296258)
+++ projects/vnet/sys/netinet/tcp_subr.c	Tue Mar  1 10:29:06 2016	(r296259)
@@ -738,9 +738,6 @@ tcp_destroy(void *unused __unused)
 {
 	int error;
 
-#ifdef TCP_RFC7413
-	tcp_fastopen_destroy();
-#endif
 	tcp_hc_destroy();
 	syncache_destroy();
 	tcp_tw_destroy();
@@ -748,6 +745,14 @@ tcp_destroy(void *unused __unused)
 	uma_zdestroy(V_sack_hole_zone);
 	uma_zdestroy(V_tcpcb_zone);
 
+#ifdef TCP_RFC7413
+	/*
+	 * Cannot free the zone until all tcpcbs are released as we attach
+	 * the allocations to them.
+	 */
+	tcp_fastopen_destroy();
+#endif
+
 	error = hhook_head_deregister(V_tcp_hhh[HHOOK_TCP_EST_IN]);
 	if (error != 0) {
 		printf("%s: WARNING: unable to deregister helper hook "


More information about the svn-src-projects mailing list