On 3/14/26 9:13 PM, [email protected] wrote:
> diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
> index 57a2a6daaad3..53781cf591d2 100644
> --- a/net/ipv4/tcp_output.c
> +++ b/net/ipv4/tcp_output.c
> @@ -3375,13 +3375,24 @@ u32 __tcp_select_window(struct sock *sk)
>        * scaled window will not line up with the MSS boundary anyway.
>        */
>       if (tp->rx_opt.rcv_wscale) {
> +             int rcv_wscale = 1 << tp->rx_opt.rcv_wscale;
> +
>               window = free_space;
>  
>               /* Advertise enough space so that it won't get scaled away.
> -              * Import case: prevent zero window announcement if
> +              * Important case: prevent zero-window announcement if
>                * 1<<rcv_wscale > mss.
>                */
> -             window = ALIGN(window, (1 << tp->rx_opt.rcv_wscale));
> +             window = ALIGN(window, rcv_wscale);
> +
> +             /* Back any scale-quantization slack before we expose it.
> +              * Otherwise tcp_can_ingest() can reject data which is still
> +              * within the sender-visible window.
> +              */
> +             if (window > free_space &&
> +                 (!tcp_rcvbuf_grow_allowed(sk) ||
> +                  !tcp_try_grow_rcvbuf(sk, tcp_space_from_win(sk, window))))
> +                     window = round_down(free_space, rcv_wscale);

It looks like this can cause the advertised window to shrink even if we
are in the 'do not allow window to shrink' branch.

Also why the other branch (shrinking allowed) is not touched?

/P


Reply via email to