Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Aug 2009 11:44:17 +0000 (UTC)
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r196537 - in stable/7/sys: . contrib/pf netinet
Message-ID:  <200908251144.n7PBiH8m026684@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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.



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