summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--net/ipv4/tcp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index eb5a60c7a9cc..46951e749308 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3693,7 +3693,7 @@ EXPORT_SYMBOL(tcp_sock_set_keepcnt);
int tcp_set_window_clamp(struct sock *sk, int val)
{
- u32 old_window_clamp, new_window_clamp;
+ u32 old_window_clamp, new_window_clamp, new_rcv_ssthresh;
struct tcp_sock *tp = tcp_sk(sk);
if (!val) {
@@ -3714,12 +3714,12 @@ int tcp_set_window_clamp(struct sock *sk, int val)
/* Need to apply the reserved mem provisioning only
* when shrinking the window clamp.
*/
- if (new_window_clamp < old_window_clamp)
+ if (new_window_clamp < old_window_clamp) {
__tcp_adjust_rcv_ssthresh(sk, new_window_clamp);
- else
- tp->rcv_ssthresh = clamp(new_window_clamp,
- tp->rcv_ssthresh,
- tp->rcv_wnd);
+ } else {
+ new_rcv_ssthresh = min(tp->rcv_wnd, new_window_clamp);
+ tp->rcv_ssthresh = max(new_rcv_ssthresh, tp->rcv_ssthresh);
+ }
return 0;
}