Commit da0a106
committed
netfilter: nf_tables: don't skip expired elements during walk
jira VUlN-429
subsystem-sync netfilter:nf_tables 4.18.0-553
commit-author Florian Westphal <fw@strlen.de>
commit 2413893
There is an asymmetry between commit/abort and preparation phase if the
following conditions are met:
1. set is a verdict map ("1.2.3.4 : jump foo")
2. timeouts are enabled
In this case, following sequence is problematic:
1. element E in set S refers to chain C
2. userspace requests removal of set S
3. kernel does a set walk to decrement chain->use count for all elements
from preparation phase
4. kernel does another set walk to remove elements from the commit phase
(or another walk to do a chain->use increment for all elements from
abort phase)
If E has already expired in 1), it will be ignored during list walk, so its use count
won't have been changed.
Then, when set is culled, ->destroy callback will zap the element via
nf_tables_set_elem_destroy(), but this function is only safe for
elements that have been deactivated earlier from the preparation phase:
lack of earlier deactivate removes the element but leaks the chain use
count, which results in a WARN splat when the chain gets removed later,
plus a leak of the nft_chain structure.
Update pipapo_get() not to skip expired elements, otherwise flush
command reports bogus ENOENT errors.
Fixes: 3c4287f ("nf_tables: Add set type for arbitrary concatenation of ranges")
Fixes: 8d8540c ("netfilter: nft_set_rbtree: add timeout support")
Fixes: 9d09829 ("netfilter: nft_hash: add support for timeouts")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
(cherry picked from commit 2413893)
Signed-off-by: Greg Rose <g.v.rose@ciq.com>1 parent e734975 commit da0a106
File tree
4 files changed
+16
-10
lines changed- net/netfilter
4 files changed
+16
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4754 | 4754 | | |
4755 | 4755 | | |
4756 | 4756 | | |
| 4757 | + | |
4757 | 4758 | | |
4758 | 4759 | | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
4759 | 4763 | | |
4760 | 4764 | | |
4761 | 4765 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
266 | | - | |
267 | 265 | | |
268 | 266 | | |
269 | 267 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
704 | 704 | | |
705 | 705 | | |
706 | 706 | | |
707 | | - | |
708 | | - | |
| 707 | + | |
709 | 708 | | |
710 | 709 | | |
711 | 710 | | |
| |||
739 | 738 | | |
740 | 739 | | |
741 | 740 | | |
742 | | - | |
743 | | - | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
744 | 752 | | |
745 | 753 | | |
746 | 754 | | |
| |||
1890 | 1898 | | |
1891 | 1899 | | |
1892 | 1900 | | |
1893 | | - | |
1894 | | - | |
1895 | 1901 | | |
1896 | 1902 | | |
1897 | 1903 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
449 | | - | |
450 | | - | |
451 | 449 | | |
452 | 450 | | |
453 | 451 | | |
| |||
0 commit comments