From owner-svn-src-stable@FreeBSD.ORG Wed Jan 6 16:49:00 2010 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 5A320106566B; Wed, 6 Jan 2010 16:49:00 +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 493108FC1B; Wed, 6 Jan 2010 16:49:00 +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 o06Gn0kG081669; Wed, 6 Jan 2010 16:49:00 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o06Gn0wd081668; Wed, 6 Jan 2010 16:49:00 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201001061649.o06Gn0wd081668@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 6 Jan 2010 16:49:00 +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: r201654 - stable/7/sys/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: Wed, 06 Jan 2010 16:49:00 -0000 Author: bz Date: Wed Jan 6 16:48:59 2010 New Revision: 201654 URL: http://svn.freebsd.org/changeset/base/201654 Log: MFC r184720: Fix a bug introduced with r182851 (r201653 in stable/7) splitting tcp_mss() into tcp_mss() and tcp_mss_update() so that tcp_mtudisc() could re-use the same code. In case we return early and got a metricptr to pass the hostcache info back to the caller we need to initialize the data to a defined state (zero it) as tcp_hc_get() would do if there was no hit. Without that the caller would check on random stack garbage which could lead to undefined results. This only affected tcp_mss() if there was no routing entry for the peer, tcp_mtudisc() was not affected. Modified: stable/7/sys/netinet/tcp_input.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/netinet/tcp_input.c ============================================================================== --- stable/7/sys/netinet/tcp_input.c Wed Jan 6 16:43:09 2010 (r201653) +++ stable/7/sys/netinet/tcp_input.c Wed Jan 6 16:48:59 2010 (r201654) @@ -2761,8 +2761,16 @@ tcp_mss_update(struct tcpcb *tp, int off /* * No route to sender, stay with default mss and return. */ - if (maxmtu == 0) + if (maxmtu == 0) { + /* + * In case we return early we need to intialize metrics + * to a defined state as tcp_hc_get() would do for us + * if there was no cache hit. + */ + if (metricptr != NULL) + bzero(metricptr, sizeof(struct hc_metrics_lite)); return; + } /* Check the interface for TSO capabilities. */ if (mtuflags & CSUM_TSO)