Commit 0bcfbafb authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: conntrack: avoid unconditional local_bh_disable

Now that the conntrack entry isn't placed on the pcpu list anymore the
bh only needs to be disabled in the 'expectation present' case.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 8a75a2c1
...@@ -1736,10 +1736,9 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, ...@@ -1736,10 +1736,9 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
ecache ? ecache->expmask : 0, ecache ? ecache->expmask : 0,
GFP_ATOMIC); GFP_ATOMIC);
local_bh_disable();
cnet = nf_ct_pernet(net); cnet = nf_ct_pernet(net);
if (cnet->expect_count) { if (cnet->expect_count) {
spin_lock(&nf_conntrack_expect_lock); spin_lock_bh(&nf_conntrack_expect_lock);
exp = nf_ct_find_expectation(net, zone, tuple); exp = nf_ct_find_expectation(net, zone, tuple);
if (exp) { if (exp) {
pr_debug("expectation arrives ct=%p exp=%p\n", pr_debug("expectation arrives ct=%p exp=%p\n",
...@@ -1762,7 +1761,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, ...@@ -1762,7 +1761,7 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
#endif #endif
NF_CT_STAT_INC(net, expect_new); NF_CT_STAT_INC(net, expect_new);
} }
spin_unlock(&nf_conntrack_expect_lock); spin_unlock_bh(&nf_conntrack_expect_lock);
} }
if (!exp) if (!exp)
__nf_ct_try_assign_helper(ct, tmpl, GFP_ATOMIC); __nf_ct_try_assign_helper(ct, tmpl, GFP_ATOMIC);
...@@ -1770,8 +1769,6 @@ init_conntrack(struct net *net, struct nf_conn *tmpl, ...@@ -1770,8 +1769,6 @@ init_conntrack(struct net *net, struct nf_conn *tmpl,
/* Now it is going to be associated with an sk_buff, set refcount to 1. */ /* Now it is going to be associated with an sk_buff, set refcount to 1. */
refcount_set(&ct->ct_general.use, 1); refcount_set(&ct->ct_general.use, 1);
local_bh_enable();
if (exp) { if (exp) {
if (exp->expectfn) if (exp->expectfn)
exp->expectfn(ct, exp); exp->expectfn(ct, exp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment