Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Dec 2017 12:54:21 +0000 (UTC)
From:      "Andrey V. Elsukov" <ae@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r326847 - head/sys/netinet
Message-ID:  <201712141254.vBECsLee069280@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ae
Date: Thu Dec 14 12:54:20 2017
New Revision: 326847
URL: https://svnweb.freebsd.org/changeset/base/326847

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

Modified:
  head/sys/netinet/tcp_output.c

Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c	Thu Dec 14 11:45:02 2017	(r326846)
+++ head/sys/netinet/tcp_output.c	Thu Dec 14 12:54:20 2017	(r326847)
@@ -1239,12 +1239,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;
 		}
 	}



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