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;
                }
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to