Return-Path: Received: from mail-dm3nam03on0108.outbound.protection.outlook.com ([104.47.41.108]:62150 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754236AbeARVBD (ORCPT ); Thu, 18 Jan 2018 16:01:03 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Eric Dumazet , "David S . Miller" , Sasha Levin Subject: [added to the 4.1 stable tree] tcp: initialize icsk_ack.lrcvtime at session start time Date: Thu, 18 Jan 2018 20:59:57 +0000 Message-ID: <20180118205908.3220-64-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Eric Dumazet This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit 15bb7745e94a665caf42bfaabf0ce062845b533b ] icsk_ack.lrcvtime has a 0 value at socket creation time. tcpi_last_data_recv can have bogus value if no payload is ever received. This patch initializes icsk_ack.lrcvtime for active sessions in tcp_finish_connect(), and for passive sessions in tcp_create_openreq_child() Signed-off-by: Eric Dumazet Acked-by: Neal Cardwell Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 2 +- net/ipv4/tcp_minisocks.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 95f98d2444fa..adfb709c6ee6 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -5388,6 +5388,7 @@ void tcp_finish_connect(struct sock *sk, struct sk_bu= ff *skb) struct inet_connection_sock *icsk =3D inet_csk(sk); =20 tcp_set_state(sk, TCP_ESTABLISHED); + icsk->icsk_ack.lrcvtime =3D tcp_time_stamp; =20 if (skb) { icsk->icsk_af_ops->sk_rx_dst_set(sk, skb); @@ -5600,7 +5601,6 @@ static int tcp_rcv_synsent_state_process(struct sock = *sk, struct sk_buff *skb, * to stand against the temptation 8) --ANK */ inet_csk_schedule_ack(sk); - icsk->icsk_ack.lrcvtime =3D tcp_time_stamp; tcp_enter_quickack_mode(sk); inet_csk_reset_xmit_timer(sk, ICSK_TIME_DACK, TCP_DELACK_MAX, TCP_RTO_MAX); diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index fec2907b85e8..2c58a5d4cba8 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -462,6 +462,7 @@ struct sock *tcp_create_openreq_child(struct sock *sk, = struct request_sock *req, newtp->srtt_us =3D 0; newtp->mdev_us =3D jiffies_to_usecs(TCP_TIMEOUT_INIT); newicsk->icsk_rto =3D TCP_TIMEOUT_INIT; + newicsk->icsk_ack.lrcvtime =3D tcp_time_stamp; =20 newtp->packets_out =3D 0; newtp->retrans_out =3D 0; --=20 2.11.0