Date: Thu, 6 Nov 2008 12:33:33 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r184720 - head/sys/netinet Message-ID: <200811061233.mA6CXXCb055643@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Thu Nov 6 12:33:33 2008 New Revision: 184720 URL: http://svn.freebsd.org/changeset/base/184720 Log: Fix a bug introduced with r182851 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. MFC after: 2 months (along with r182851) Modified: head/sys/netinet/tcp_input.c Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Thu Nov 6 11:43:49 2008 (r184719) +++ head/sys/netinet/tcp_input.c Thu Nov 6 12:33:33 2008 (r184720) @@ -2847,8 +2847,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)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811061233.mA6CXXCb055643>