summaryrefslogtreecommitdiffstats
path: root/net/netfilter/nf_conntrack_core.c
diff options
context:
space:
mode:
authorFlorian Westphal2016-08-25 15:33:29 +0200
committerPablo Neira Ayuso2016-08-30 11:43:08 +0200
commit95a8d19f28e6b29377a880c6264391a62e07fccc (patch)
tree81fc67ab9b30fc35ed1d22116e7c5905e3018ad2 /net/netfilter/nf_conntrack_core.c
parentnetfilter: nf_tables: Use nla_put_be32() to dump immediate parameters (diff)
downloadkernel-qcow2-linux-95a8d19f28e6b29377a880c6264391a62e07fccc.tar.gz
kernel-qcow2-linux-95a8d19f28e6b29377a880c6264391a62e07fccc.tar.xz
kernel-qcow2-linux-95a8d19f28e6b29377a880c6264391a62e07fccc.zip
netfilter: restart search if moved to other chain
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> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter/nf_conntrack_core.c')
-rw-r--r--net/netfilter/nf_conntrack_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index 7d90a5d15113..887926aefc72 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;