Author: bz
Date: Tue Aug 25 11:44:17 2009
New Revision: 196537
URL: http://svn.freebsd.org/changeset/base/196537

Log:
  MFC r182841:
  
    Add a second KASSERT checking for len >= 0 in the tcp output path.
  
    This is different to the first one (as len gets updated between those
    two) and would have caught various edge cases (read bugs) at a well
    defined place I had been debugging the last months instead of
    triggering (random) panics further down the call graph.

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/netinet/tcp_output.c

Modified: stable/7/sys/netinet/tcp_output.c
==============================================================================
--- stable/7/sys/netinet/tcp_output.c   Tue Aug 25 10:09:25 2009        
(r196536)
+++ stable/7/sys/netinet/tcp_output.c   Tue Aug 25 11:44:17 2009        
(r196537)
@@ -391,7 +391,7 @@ after_sack_rexmit:
        }
 
        /* len will be >= 0 after this point. */
-       KASSERT(len >= 0, ("%s: len < 0", __func__));
+       KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__));
 
        /*
         * Automatic sizing of send socket buffer.  Often the send buffer
@@ -741,6 +741,12 @@ send:
 /*#endif*/
 
        /*
+        * This KASSERT is here to catch edge cases at a well defined place.
+        * Before, those had triggered (random) panic conditions further down.
+        */
+       KASSERT(len >= 0, ("[%s:%d]: len < 0", __func__, __LINE__));
+
+       /*
         * Grab a header mbuf, attaching a copy of data to
         * be transmitted, and initialize the header from
         * the template for sends on this connection.
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to