On Fri, 8 Aug 2025 06:51:06 -0700 Eric Dumazet wrote:
> > > Can a 2^32 wrap occur eventually ?
> >
> > Hm, good point. Is it good enough if we also check it in data_ready?
> > That way we should notice that someone is eating our data before
> > the seq had a chance to wrap?
>
> I could not understand what your suggestion was.
>
> Perhaps store both copued_seq and tp->bytes_received and
>
> check if (tp->bytes_received - strp->bytes_received) is smaller than 2^31 .
>
> if (unlikely(strp->copied_seq != tp->copied_seq ||
> (tp->bytes_received -
> strp->bytes_received >= (1ULL < 31)) ||
> WARN_ON(tcp_inq(strp->sk) < strp->stm.full_len)))
> {
Nice, I think that would work.
I was wondering how to solve this yesterday and I realized the extra
condition isn't really needed. We just have to handle the inq < full_len
more carefully and remove the WARN_ON(). I posted a v2.