Skip to content

Commit

Permalink
netfilter: nft_set_rbtree: overlap detection with element re-addition…
Browse files Browse the repository at this point in the history
… after deletion

[ Upstream commit babc3dc ]

This patch fixes spurious EEXIST errors.

Extend d2df92e ("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 7c84d41 ("netfilter:
nft_set_rbtree: Detect partial overlaps on insertion").

Fixes: 7c84d41 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion")
Fixes: d2df92e ("netfilter: nft_set_rbtree: handle element re-addition after deletion")
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Reviewed-by: Stefano Brivio <[email protected]>
Signed-off-by: Pablo Neira Ayuso <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
ummakynes authored and Sasha Levin committed May 8, 2022
1 parent 4a6c468 commit 089a129
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion net/netfilter/nft_set_rbtree.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 089a129

Please sign in to comment.