Re: [PATCH net] net: tcp: Update the type of scaling_ratio

From: Horatiu Vultur
Date: Mon May 06 2024 - 09:14:26 EST


The 05/06/2024 14:35, Eric Dumazet wrote:
>
> On Mon, May 6, 2024 at 2:04 PM Horatiu Vultur
> <horatiu.vultur@xxxxxxxxxxxxx> wrote:

Hi Eric,

> >
> > It was noticed the following issue that sometimes the scaling_ratio was
> > getting a value of 0, meaning that window space was having a value of 0,
> > so then the tcp connection was stopping.
> > The reason why the scaling_ratio was getting a value of 0 is because
> > when it was calculated, it was truncated from a u64 to a u8. So for
> > example if it scaling_ratio was supposed to be 256 it was getting a
> > value of 0.
> > The fix consists in chaning the type of scaling_ratio from u8 to u16.
> >
> > Fixes: dfa2f0483360 ("tcp: get rid of sysctl_tcp_adv_win_scale")
> > Signed-off-by: Horatiu Vultur <horatiu.vultur@xxxxxxxxxxxxx>
> > ---
>
> This is a wrong patch. We need to fix the root cause instead.
>
> By definition, skb->len / skb->truesize must be < 1
>
> If not, a driver is lying to us and this is quite bad.
>
> Please take a look at the following patch for a real fix.
>
> 4ce62d5b2f7aecd4900e7d6115588ad7f9acccca net: usb: ax88179_178a: stop
> lying about skb->truesize

Thanks for explanation and for the suggestion.
I have tried this on a driver that is not yet upstream.
Sorry for the noise.

--
/Horatiu