Commit dc6ae4d
tcp: detect malicious patterns in tcp_collapse_ofo_queue()
[ Upstream commit 3d4bf93 ]
In case an attacker feeds tiny packets completely out of order,
tcp_collapse_ofo_queue() might scan the whole rb-tree, performing
expensive copies, but not changing socket memory usage at all.
1) Do not attempt to collapse tiny skbs.
2) Add logic to exit early when too many tiny skbs are detected.
We prefer not doing aggressive collapsing (which copies packets)
for pathological flows, and revert to tcp_prune_ofo_queue() which
will be less expensive.
In the future, we might add the possibility of terminating flows
that are proven to be malicious.
Signed-off-by: Eric Dumazet <[email protected]>
Acked-by: Soheil Hassas Yeganeh <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 5fbec48 commit dc6ae4d
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4789 | 4789 | | |
4790 | 4790 | | |
4791 | 4791 | | |
| 4792 | + | |
4792 | 4793 | | |
4793 | 4794 | | |
4794 | 4795 | | |
| |||
4798 | 4799 | | |
4799 | 4800 | | |
4800 | 4801 | | |
| 4802 | + | |
4801 | 4803 | | |
4802 | 4804 | | |
4803 | 4805 | | |
| |||
4812 | 4814 | | |
4813 | 4815 | | |
4814 | 4816 | | |
4815 | | - | |
4816 | | - | |
| 4817 | + | |
| 4818 | + | |
| 4819 | + | |
| 4820 | + | |
| 4821 | + | |
| 4822 | + | |
| 4823 | + | |
| 4824 | + | |
| 4825 | + | |
| 4826 | + | |
| 4827 | + | |
4817 | 4828 | | |
4818 | 4829 | | |
4819 | 4830 | | |
4820 | 4831 | | |
4821 | 4832 | | |
4822 | 4833 | | |
| 4834 | + | |
4823 | 4835 | | |
4824 | 4836 | | |
4825 | 4837 | | |
| |||
0 commit comments