Skip to content

Commit

Permalink
netfilter: nft_set_rbtree: check for inactive element after flag mism…
Browse files Browse the repository at this point in the history
…atch

[ Upstream commit 05b7639da55f5555b9866a1f4b7e8995232a6323 ]

Otherwise, we hit bogus ENOENT when removing elements.

Fixes: e701001 ("netfilter: nft_rbtree: allow adjacent intervals with dynamic updates")
Reported-by: Václav Zindulka <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Sasha Levin (Microsoft) <[email protected]>
  • Loading branch information
ummakynes authored and gregkh committed May 4, 2019
1 parent aba0a08 commit 54fa583
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions net/netfilter/nft_set_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,6 @@ static void *nft_rbtree_deactivate(const struct net *net,
else if (d > 0)
parent = parent->rb_right;
else {
if (!nft_set_elem_active(&rbe->ext, genmask)) {
parent = parent->rb_left;
continue;
}
if (nft_rbtree_interval_end(rbe) &&
!nft_rbtree_interval_end(this)) {
parent = parent->rb_left;
Expand All @@ -203,6 +199,9 @@ static void *nft_rbtree_deactivate(const struct net *net,
nft_rbtree_interval_end(this)) {
parent = parent->rb_right;
continue;
} else if (!nft_set_elem_active(&rbe->ext, genmask)) {
parent = parent->rb_left;
continue;
}
nft_set_elem_change_active(net, set, &rbe->ext);
return rbe;
Expand Down

0 comments on commit 54fa583

Please sign in to comment.