]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
tcp: free batches of packets in tcp_prune_ofo_queue()
authorEric Dumazet <edumazet@google.com>
Mon, 23 Jul 2018 16:28:17 +0000 (09:28 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Thu, 26 Jul 2018 15:25:51 +0000 (17:25 +0200)
commitbf9a5c26c46b1a5b49e9f7592740ab42cb6119a5
tree8c65bed3719169a4efe64ad1968e524ff5e2b639
parent8a4679703e1df666a44c7b23b012633254d1f568
tcp: free batches of packets in tcp_prune_ofo_queue()

Juha-Matti Tilli reported that malicious peers could inject tiny
packets in out_of_order_queue, forcing very expensive calls
to tcp_collapse_ofo_queue() and tcp_prune_ofo_queue() for
every incoming packet. out_of_order_queue rb-tree can contain
thousands of nodes, iterating over all of them is not nice.

Before linux-4.9, we would have pruned all packets in ofo_queue
in one go, every XXXX packets. XXXX depends on sk_rcvbuf and skbs
truesize, but is about 7000 packets with tcp_rmem[2] default of 6 MB.

Since we plan to increase tcp_rmem[2] in the future to cope with
modern BDP, can not revert to the old behavior, without great pain.

Strategy taken in this patch is to purge ~12.5 % of the queue capacity.

Fixes: 36a6503fedda ("tcp: refine tcp_prune_ofo_queue() to not drop all packets")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Juha-Matti Tilli <juha-matti.tilli@iki.fi>
Acked-by: Yuchung Cheng <ycheng@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
CVE-2018-5390

(cherry picked from commit 72cd43ba64fc172a443410ce01645895850844c8)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/ipv4/tcp_input.c