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 2/9] netfilter: nft_set_rbtree: check for inactive element after flag mismatch
Date: Thu, 21 Mar 2019 12:28:38 +0100	[thread overview]
Message-ID: <20190321112845.10627-3-pablo@netfilter.org> (raw)
In-Reply-To: <20190321112845.10627-1-pablo@netfilter.org>

Otherwise, we hit bogus ENOENT when removing elements.

Fixes: e701001e7cbe ("netfilter: nft_rbtree: allow adjacent intervals with dynamic updates")
Reported-by: Václav Zindulka <vaclav.zindulka@tlapnet.cz>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
 net/netfilter/nft_set_rbtree.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/net/netfilter/nft_set_rbtree.c b/net/netfilter/nft_set_rbtree.c
index fa61208371f8..321a0036fdf5 100644
--- a/net/netfilter/nft_set_rbtree.c
+++ b/net/netfilter/nft_set_rbtree.c
@@ -308,10 +308,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;
@@ -320,6 +316,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_rbtree_flush(net, set, rbe);
 			return rbe;
-- 
2.11.0


  parent reply	other threads:[~2019-03-21 11:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-21 11:28 [PATCH 0/9] Netfilter fixes for net Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 1/9] netfilter: nf_conntrack_sip: remove direct dependency on IPv6 Pablo Neira Ayuso
2019-03-21 11:28 ` Pablo Neira Ayuso [this message]
2019-03-21 11:28 ` [PATCH 3/9] netfilter: bridge: set skb transport_header before entering NF_INET_PRE_ROUTING Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 4/9] netfilter: fix NETFILTER_XT_TARGET_TEE dependencies Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 5/9] netfilter: ip6t_srh: fix NULL pointer dereferences Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 6/9] netfilter: nf_tables: bogus EBUSY in helper removal from transaction Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 7/9] netfilter: nft_redir: fix module autoload with ip4 Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 8/9] netfilter: nf_flowtable: remove duplicated transition in diagram Pablo Neira Ayuso
2019-03-21 11:28 ` [PATCH 9/9] netfilter: nf_tables: add missing ->release_ops() in error path of newrule() Pablo Neira Ayuso
2019-03-21 17:07 ` [PATCH 0/9] Netfilter fixes for net David Miller

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=20190321112845.10627-3-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).