]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tcp: fix a stale ooo_last_skb after a replace
authorEric Dumazet <edumazet@google.com>
Wed, 14 Sep 2016 05:55:05 +0000 (22:55 -0700)
committerBrian Maly <brian.maly@oracle.com>
Tue, 10 Sep 2019 14:55:43 +0000 (10:55 -0400)
commitea63a6cfb2467754c4ba0dece662350cacd7714b
tree3fb02275b09d62ad1624e4c2bb0cde420bc078cd
parent1e59d94e6124de8fb26ba6d0c2d6f07658ddcd01
tcp: fix a stale ooo_last_skb after a replace

When skb replaces another one in ooo queue, I forgot to also
update tp->ooo_last_skb as well, if the replaced skb was the last one
in the queue.

To fix this, we simply can re-use the code that runs after an insertion,
trying to merge skbs at the right of current skb.

This not only fixes the bug, but also remove all small skbs that might
be a subset of the new one.

Example:

We receive segments 2001:3001,  4001:5001

Then we receive 2001:8001 : We should replace 2001:3001 with the big
skb, but also remove 4001:50001 from the queue to save space.

packetdrill test demonstrating the bug

0.000 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3
+0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0
+0 bind(3, ..., ...) = 0
+0 listen(3, 1) = 0

+0 < S 0:0(0) win 32792 <mss 1000,sackOK,nop,nop,nop,wscale 7>
+0 > S. 0:0(0) ack 1 <mss 1460,nop,nop,sackOK,nop,wscale 7>
+0.100 < . 1:1(0) ack 1 win 1024
+0 accept(3, ..., ...) = 4

+0.01 < . 1001:2001(1000) ack 1 win 1024
+0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001>

+0.01 < . 1001:3001(2000) ack 1 win 1024
+0    > . 1:1(0) ack 1 <nop,nop, sack 1001:2001 1001:3001>

Fixes: 9f5afeae5152 ("tcp: use an RB tree for ooo receive queue")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Yuchung Cheng <ycheng@google.com>
Cc: Yaogong Wang <wygivan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 76f0dcbb5ae1a7c3dbeec13dd98233b8e6b0b32a)

Orabug: 29997352
Signed-off-by: Jacob Wen <jian.w.wen@oracle.com>
Reviewed-by: Darren Kenny <darren.kenny@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
Conflicts:
net/ipv4/tcp_input.c
tcp_drop was introduced by d0f2a1c0e4

Signed-off-by: Brian Maly <brian.maly@oracle.com>
net/ipv4/tcp_input.c