Commit 02bc27cb authored by David S. Miller's avatar David S. Miller

[TCP]: Do not overflow 16-bit window field in tcp_select_window().

Signed-off-by: default avatarDavid S. Miller <davem@redhat.com>
parent c5de793d
...@@ -168,6 +168,14 @@ static __inline__ u16 tcp_select_window(struct sock *sk) ...@@ -168,6 +168,14 @@ static __inline__ u16 tcp_select_window(struct sock *sk)
tp->rcv_wnd = new_win; tp->rcv_wnd = new_win;
tp->rcv_wup = tp->rcv_nxt; tp->rcv_wup = tp->rcv_nxt;
/* Make sure we do not exceed the maximum possible
* scaled window.
*/
if (!tp->rcv_wscale)
new_win = min(new_win, MAX_TCP_WINDOW);
else
new_win = min(new_win, (65535U << tp->rcv_wscale));
/* RFC1323 scaling applied */ /* RFC1323 scaling applied */
new_win >>= tp->rcv_wscale; new_win >>= tp->rcv_wscale;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment