]> git.baikalelectronics.ru Git - kernel.git/commit
tcp: add sanity tests in tcp_add_backlog()
authorEric Dumazet <edumazet@google.com>
Fri, 26 Apr 2019 17:10:05 +0000 (10:10 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 30 Apr 2019 03:20:37 +0000 (23:20 -0400)
commit24c94518f7d83a9c4c57fc4f68278e335f2d7b41
tree90154971d0ed9528cecb582a7c441577b9c243d7
parentedd1a4cd80be1dde8dd6cadcc64acf92e3dd2033
tcp: add sanity tests in tcp_add_backlog()

Richard and Bruno both reported that my commit added a bug,
and Bruno was able to determine the problem came when a segment
wih a FIN packet was coalesced to a prior one in tcp backlog queue.

It turns out the header prediction in tcp_rcv_established()
looks back to TCP headers in the packet, not in the metadata
(aka TCP_SKB_CB(skb)->tcp_flags)

The fast path in tcp_rcv_established() is not supposed to
handle a FIN flag (it does not call tcp_fin())

Therefore we need to make sure to propagate the FIN flag,
so that the coalesced packet does not go through the fast path,
the same than a GRO packet carrying a FIN flag.

While we are at it, make sure we do not coalesce packets with
RST or SYN, or if they do not have ACK set.

Many thanks to Richard and Bruno for pinpointing the bad commit,
and to Richard for providing a first version of the fix.

Fixes: 907842847cc3 ("tcp: implement coalescing on backlog queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Reported-by: Bruno Prémont <bonbons@sysophe.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_ipv4.c