svn commit: r327061 - stable/11/sys/netinet

Andrey V. Elsukov ae at FreeBSD.org
Thu Dec 21 14:09:07 UTC 2017


Author: ae
Date: Thu Dec 21 14:09:06 2017
New Revision: 327061
URL: https://svnweb.freebsd.org/changeset/base/327061

Log:
  MFC r326847:
    Fix mbuf leak when TCPMD5_OUTPUT() method returns error.
  
    PR:		223817

Modified:
  stable/11/sys/netinet/tcp_output.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/netinet/tcp_output.c
==============================================================================
--- stable/11/sys/netinet/tcp_output.c	Thu Dec 21 13:32:49 2017	(r327060)
+++ stable/11/sys/netinet/tcp_output.c	Thu Dec 21 14:09:06 2017	(r327061)
@@ -1275,12 +1275,13 @@ send:
 		 * NOTE: since TCP options buffer doesn't point into
 		 * mbuf's data, calculate offset and use it.
 		 */
-		if (!TCPMD5_ENABLED() || TCPMD5_OUTPUT(m, th,
-		    (u_char *)(th + 1) + (to.to_signature - opt)) != 0) {
+		if (!TCPMD5_ENABLED() || (error = TCPMD5_OUTPUT(m, th,
+		    (u_char *)(th + 1) + (to.to_signature - opt))) != 0) {
 			/*
 			 * Do not send segment if the calculation of MD5
 			 * digest has failed.
 			 */
+			m_freem(m);
 			goto out;
 		}
 	}


More information about the svn-src-all mailing list