]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nft_set_rbtree: fix overlap expiration walk
authorFlorian Westphal <fw@strlen.de>
Thu, 20 Jul 2023 19:30:05 +0000 (21:30 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 26 Jul 2023 14:48:13 +0000 (16:48 +0200)
commitf718863aca469a109895cb855e6b81fff4827d71
tree3643843632bc86ea08c7777b2956ade17b019304
parentd4a7ce642100765119a872d4aba1bf63e3a22c8a
netfilter: nft_set_rbtree: fix overlap expiration walk

The lazy gc on insert that should remove timed-out entries fails to release
the other half of the interval, if any.

Can be reproduced with tests/shell/testcases/sets/0044interval_overlap_0
in nftables.git and kmemleak enabled kernel.

Second bug is the use of rbe_prev vs. prev pointer.
If rbe_prev() returns NULL after at least one iteration, rbe_prev points
to element that is not an end interval, hence it should not be removed.

Lastly, check the genmask of the end interval if this is active in the
current generation.

Fixes: c9e6978e2725 ("netfilter: nft_set_rbtree: Switch to node list walk for overlap detection")
Signed-off-by: Florian Westphal <fw@strlen.de>
net/netfilter/nft_set_rbtree.c