From owner-svn-src-stable@FreeBSD.ORG Tue Aug 25 11:44:17 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 97AA61065757; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854AD8FC15; Tue, 25 Aug 2009 11:44:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n7PBiHEE026686; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n7PBiH8m026684; Tue, 25 Aug 2009 11:44:17 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200908251144.n7PBiH8m026684@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Tue, 25 Aug 2009 11:44:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r196537 - in stable/7/sys: . contrib/pf netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Aug 2009 11:44:17 -0000 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.