From d5e7d9425f4ca7758f7fb4cc1788816ff606e245 Mon Sep 17 00:00:00 2001 From: tuexen Date: Mon, 17 Feb 2020 14:54:21 +0000 Subject: [PATCH] Don't use uninitialised stack memory if the sysctl variable net.inet.tcp.hostcache.enable is set to 0. The bug resulted in using possibly a too small MSS value or wrong initial retransmission timer settings. Possibly the value used for ssthresh was also wrong. Submitted by: Richard Scheffenegger Reviewed by: Cheng Cui, rgrimes@, tuexen@ MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D23687 --- sys/netinet/tcp_hostcache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 1b4dc0d24655..2753d511c9d5 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -437,8 +437,10 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) { struct hc_metrics *hc_entry; - if (!V_tcp_use_hostcache) + if (!V_tcp_use_hostcache) { + bzero(hc_metrics_lite, sizeof(*hc_metrics_lite)); return; + } /* * Find the right bucket.