netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Westphal <fw@strlen.de>
To: <netfilter-devel@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH v3 nf-next 1/7] netfilter: restart search if moved to other chain
Date: Thu, 25 Aug 2016 15:33:29 +0200	[thread overview]
Message-ID: <1472132015-10264-2-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1472132015-10264-1-git-send-email-fw@strlen.de>

In case nf_conntrack_tuple_taken did not find a conflicting entry
check that all entries in this hash slot were tested and restart
in case an entry was moved to another chain.

Reported-by: Eric Dumazet <edumazet@google.com>
Fixes: ea781f197d6a ("netfilter: nf_conntrack: use SLAB_DESTROY_BY_RCU and get rid of call_rcu()")
Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Eric Dumazet <edumazet@google.com>
---
 net/netfilter/nf_conntrack_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 7d90a5d..887926a 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -809,6 +809,7 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
 	zone = nf_ct_zone(ignored_conntrack);
 
 	rcu_read_lock();
+ begin:
 	nf_conntrack_get_ht(&ct_hash, &hsize);
 	hash = __hash_conntrack(net, tuple, hsize);
 
@@ -822,6 +823,12 @@ nf_conntrack_tuple_taken(const struct nf_conntrack_tuple *tuple,
 		}
 		NF_CT_STAT_INC_ATOMIC(net, searched);
 	}
+
+	if (get_nulls_value(n) != hash) {
+		NF_CT_STAT_INC_ATOMIC(net, search_restart);
+		goto begin;
+	}
+
 	rcu_read_unlock();
 
 	return 0;
-- 
2.7.3


  reply	other threads:[~2016-08-25 13:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 13:33 netfilter: get rid of per-object conntrack timers Florian Westphal
2016-08-25 13:33 ` Florian Westphal [this message]
2016-08-25 13:33 ` [PATCH v3 nf-next 2/7] netfilter: don't rely on DYING bit to detect when destroy event was sent Florian Westphal
2016-08-25 13:33 ` [PATCH v3 nf-next 3/7] netfilter: conntrack: get rid of conntrack timer Florian Westphal
2016-08-25 13:33 ` [PATCH v3 nf-next 4/7] netfilter: evict stale entries on netlink dumps Florian Westphal
2016-08-25 13:33 ` [PATCH v3 nf-next 5/7] netfilter: conntrack: add gc worker to remove timed-out entries Florian Westphal
2016-08-25 16:06   ` Eric Dumazet
2016-08-25 13:33 ` [PATCH v3 nf-next 6/7] netfilter: conntrack: resched gc again if eviction rate is high Florian Westphal
2016-08-25 16:07   ` Eric Dumazet
2016-08-25 13:33 ` [PATCH v3 nf-next 7/7] netfilter: remove __nf_ct_kill_acct helper Florian Westphal
2016-08-30  9:43 ` netfilter: get rid of per-object conntrack timers 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=1472132015-10264-2-git-send-email-fw@strlen.de \
    --to=fw@strlen.de \
    --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).