* [PATCH] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust()
@ 2018-06-18 5:37 Guenter Roeck
2018-06-18 5:38 ` Guenter Roeck
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2018-06-18 5:37 UTC (permalink / raw)
To: stable
Cc: Benjamin Gilbert, gregkh, Eric Dumazet, David S . Miller,
Guenter Roeck
From: Eric Dumazet <edumazet@google.com>
commit 02db55718d53f9d426cee504c27fb768e9ed4ffe upstream.
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 <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
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 125b49c166a4..f0caff3139ed 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -647,7 +647,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(rcvbuf);
}
}
tp->rcvq_space.space = copied;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust()
2018-06-18 5:37 [PATCH] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust() Guenter Roeck
@ 2018-06-18 5:38 ` Guenter Roeck
2018-06-18 7:09 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Guenter Roeck @ 2018-06-18 5:38 UTC (permalink / raw)
To: stable; +Cc: Benjamin Gilbert, gregkh, Eric Dumazet, David S . Miller
This is supposed to be a backport for v4.14.y and older. Sorry for the confusion.
Guenter
On 06/17/2018 10:37 PM, Guenter Roeck wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> commit 02db55718d53f9d426cee504c27fb768e9ed4ffe upstream.
>
> 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 <edumazet@google.com>
> Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> Acked-by: Wei Wang <weiwan@google.com>
> Acked-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> 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 125b49c166a4..f0caff3139ed 100644
> --- a/net/ipv4/tcp_input.c
> +++ b/net/ipv4/tcp_input.c
> @@ -647,7 +647,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(rcvbuf);
> }
> }
> tp->rcvq_space.space = copied;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust()
2018-06-18 5:38 ` Guenter Roeck
@ 2018-06-18 7:09 ` Greg KH
0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2018-06-18 7:09 UTC (permalink / raw)
To: Guenter Roeck; +Cc: stable, Benjamin Gilbert, Eric Dumazet, David S . Miller
On Sun, Jun 17, 2018 at 10:38:54PM -0700, Guenter Roeck wrote:
> This is supposed to be a backport for v4.14.y and older. Sorry for the confusion.
Not a problem, thanks for the patch, now queued up.
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-18 7:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-18 5:37 [PATCH] tcp: do not overshoot window_clamp in tcp_rcv_space_adjust() Guenter Roeck
2018-06-18 5:38 ` Guenter Roeck
2018-06-18 7:09 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).