aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux/netfilter.h
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2016-09-21 11:35:02 -0400
committerPablo Neira Ayuso <pablo@netfilter.org>2016-09-24 21:25:49 +0200
commitfe72926b792e52ab00abfa81a201805bfb2247d6 (patch)
tree52b2a3533cd57daafceb5c3fbb13e5a1ed04bbf8 /include/linux/netfilter.h
parentnetfilter: bridge: add and use br_nf_hook_thresh (diff)
downloadwireguard-linux-fe72926b792e52ab00abfa81a201805bfb2247d6.tar.xz
wireguard-linux-fe72926b792e52ab00abfa81a201805bfb2247d6.zip
netfilter: call nf_hook_state_init with rcu_read_lock held
This makes things simpler because we can store the head of the list in the nf_state structure without worrying about concurrent add/delete of hook elements from the list. A future commit will make use of this to implement a simpler linked-list. Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Aaron Conole <aconole@bytheb.org> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'include/linux/netfilter.h')
-rw-r--r--include/linux/netfilter.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/netfilter.h b/include/linux/netfilter.h
index 9230f9aee896..ad444f0b4ed0 100644
--- a/include/linux/netfilter.h
+++ b/include/linux/netfilter.h
@@ -174,10 +174,16 @@ static inline int nf_hook_thresh(u_int8_t pf, unsigned int hook,
if (!list_empty(hook_list)) {
struct nf_hook_state state;
+ int ret;
+ /* We may already have this, but read-locks nest anyway */
+ rcu_read_lock();
nf_hook_state_init(&state, hook_list, hook, thresh,
pf, indev, outdev, sk, net, okfn);
- return nf_hook_slow(skb, &state);
+
+ ret = nf_hook_slow(skb, &state);
+ rcu_read_unlock();
+ return ret;
}
return 1;
}