Commit abbfc53d authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Greg Kroah-Hartman

netfilter: nft_set_hash: bogus element self comparison from deactivation path

[ Upstream commit a01cbae5 ]

Use the element from the loop iteration, not the same element we want to
deactivate otherwise this branch always evaluates true.

Fixes: 6c03ae21 ("netfilter: nft_set_hash: add non-resizable hashtable implementation")
Reported-by: default avatarFlorian Westphal <fw@strlen.de>
Tested-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9eebb677
...@@ -555,7 +555,7 @@ static void *nft_hash_deactivate(const struct net *net, ...@@ -555,7 +555,7 @@ static void *nft_hash_deactivate(const struct net *net,
hash = nft_jhash(set, priv, &this->ext); hash = nft_jhash(set, priv, &this->ext);
hlist_for_each_entry(he, &priv->table[hash], node) { hlist_for_each_entry(he, &priv->table[hash], node) {
if (!memcmp(nft_set_ext_key(&this->ext), &elem->key.val, if (!memcmp(nft_set_ext_key(&he->ext), &elem->key.val,
set->klen) && set->klen) &&
nft_set_elem_active(&he->ext, genmask)) { nft_set_elem_active(&he->ext, genmask)) {
nft_set_elem_change_active(net, set, &he->ext); nft_set_elem_change_active(net, set, &he->ext);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment