summaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2022-04-18 12:21:05 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-05-09 09:14:35 +0200
commitc2a69ac00b42a7a569cbaa4c5607fb3eef563706 (patch)
tree6fc349bf00d95869a3111ee0987d29c4408d2b08 /net/netfilter
parent9cc897ca03df52a2fec8632b40d45862fa75d69e (diff)
downloadlinux-stable-c2a69ac00b42a7a569cbaa4c5607fb3eef563706.tar.gz
linux-stable-c2a69ac00b42a7a569cbaa4c5607fb3eef563706.tar.bz2
linux-stable-c2a69ac00b42a7a569cbaa4c5607fb3eef563706.zip
netfilter: nft_set_rbtree: overlap detection with element re-addition after deletion
[ Upstream commit babc3dc9524f0bcb5a0ec61f3c3639b11508fad6 ] This patch fixes spurious EEXIST errors. Extend d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion") to deal with elements with same end flags in the same transation. Reset the overlap flag as described by 7c84d41416d8 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion"). Fixes: 7c84d41416d8 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion") Fixes: d2df92e98a34 ("netfilter: nft_set_rbtree: handle element re-addition after deletion") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Reviewed-by: Stefano Brivio <sbrivio@redhat.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nft_set_rbtree.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index d600a566da32..7325bee7d144 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -349,7 +349,11 @@ static int __nft_rbtree_insert(const struct net *net, const struct nft_set *set,
*ext = &rbe->ext;
return -EEXIST;
} else {
- p = &parent->rb_left;
+ overlap = false;
+ if (nft_rbtree_interval_end(rbe))
+ p = &parent->rb_left;
+ else
+ p = &parent->rb_right;
}
}