From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: [PATCH net-next 1/3] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust() Date: Sun, 10 Dec 2017 17:55:02 -0800 Message-ID: <20171211015504.26551-2-edumazet@google.com> References: <20171211015504.26551-1-edumazet@google.com> Cc: netdev , Eric Dumazet , Eric Dumazet To: "David S . Miller" , Neal Cardwell , Yuchung Cheng , Soheil Hassas Yeganeh , Wei Wang , Priyaranjan Jha Return-path: Received: from mail-it0-f65.google.com ([209.85.214.65]:36670 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbdLKBzN (ORCPT ); Sun, 10 Dec 2017 20:55:13 -0500 Received: by mail-it0-f65.google.com with SMTP id d16so12335030itj.1 for ; Sun, 10 Dec 2017 17:55:13 -0800 (PST) In-Reply-To: <20171211015504.26551-1-edumazet@google.com> Sender: netdev-owner@vger.kernel.org List-ID: While rcvbuf is properly clamped by tcp_rmem[2], rcvwin is left to a potentially too big value. It has no serious effect, since : 1) tcp_grow_window() has very strict checks. 2) window_clamp can be mangled by user space to any value anyway. tcp_init_buffer_space() and companions use tcp_full_space(), we use tcp_win_from_space() to avoid reloading sk->sk_rcvbuf Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Acked-by: Wei Wang --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 9550cc42de2d9ba4cca6d961a2a3bca501755a69..746a6773c482f5d419ddc9d7c9d52949cbb74cfb 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -631,7 +631,7 @@ void tcp_rcv_space_adjust(struct sock *sk) sk->sk_rcvbuf = rcvbuf; /* Make the window clamp follow along. */ - tp->window_clamp = rcvwin; + tp->window_clamp = tcp_win_from_space(sk, rcvbuf); } } tp->rcvq_space.space = copied; -- 2.15.1.424.g9478a66081-goog