netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: netfilter-devel@vger.kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org
Subject: [PATCH 16/29] netfilter: nft_set_hash: bogus element self comparison from deactivation path
Date: Sat,  2 Mar 2019 19:36:00 +0100	[thread overview]
Message-ID: <20190302183613.3159-7-pablo@netfilter.org> (raw)
In-Reply-To: <20190302183613.3159-1-pablo@netfilter.org>

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

Fixes: 6c03ae210ce3 ("netfilter: nft_set_hash: add non-resizable hashtable implementation")
Reported-by: Florian Westphal <fw@strlen.de>
Tested-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_set_hash.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/netfilter/nft_set_hash.c b/net/netfilter/nft_set_hash.c
index 8d5611634a56..f4da3677bdfc 100644
--- a/net/netfilter/nft_set_hash.c
+++ b/net/netfilter/nft_set_hash.c
@@ -541,7 +541,7 @@ static void *nft_hash_deactivate(const struct net *net,
 
 	hash = nft_jhash(set, priv, &this->ext);
 	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) &&
 		    nft_set_elem_active(&he->ext, genmask)) {
 			nft_set_elem_change_active(net, set, &he->ext);
-- 
2.11.0



  parent reply	other threads:[~2019-03-02 18:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 18:35 [PATCH 10/29] netfilter: nat: remove csum_recalc hook Pablo Neira Ayuso
2019-03-02 18:35 ` [PATCH 11/29] netfilter: nat: remove l3proto struct Pablo Neira Ayuso
2019-03-02 18:35 ` [PATCH 12/29] netfilter: nat: remove nf_nat_l3proto.h and nf_nat_core.h Pablo Neira Ayuso
2019-03-02 18:35 ` [PATCH 13/29] netfilter: conntrack: avoid same-timeout update Pablo Neira Ayuso
2019-03-02 18:35 ` [PATCH 14/29] netfilter: remove unneeded switch fall-through Pablo Neira Ayuso
2019-03-02 18:35 ` [PATCH 15/29] netfilter: nft_set_hash: fix lookups with fixed size hash on big endian Pablo Neira Ayuso
2019-03-02 18:36 ` Pablo Neira Ayuso [this message]
2019-03-02 18:36 ` [PATCH 17/29] netfilter: nft_set_hash: remove nft_hash_key() Pablo Neira Ayuso
2019-03-02 18:36 ` [PATCH 18/29] ipvs: change some data types from int to bool Pablo Neira Ayuso
2019-03-02 18:36 ` [PATCH 19/29] netfilter: conntrack: tcp: only close if RST matches exact sequence Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190302183613.3159-7-pablo@netfilter.org \
    --to=pablo@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).