Repository navigation
Commit 72cd43b
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: 36a6503 ("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>1 parent 3dd1c9a commit 72cd43b
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4942 | 4942 | | |
4943 | 4943 | | |
4944 | 4944 | | |
| 4945 | + | |
4945 | 4946 | | |
4946 | 4947 | | |
4947 | 4948 | | |
4948 | 4949 | | |
4949 | 4950 | | |
4950 | 4951 | | |
4951 | 4952 | | |
| 4953 | + | |
4952 | 4954 | | |
4953 | 4955 | | |
4954 | 4956 | | |
4955 | 4957 | | |
4956 | 4958 | | |
| 4959 | + | |
4957 | 4960 | | |
4958 | 4961 | | |
4959 | 4962 | | |
4960 | 4963 | | |
| 4964 | + | |
4961 | 4965 | | |
4962 | | - | |
4963 | | - | |
4964 | | - | |
4965 | | - | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
| 4972 | + | |
4966 | 4973 | | |
4967 | 4974 | | |
4968 | 4975 | | |
| |||
0 commit comments