Commit 81b4325e authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

netfilter: nf_queue: remove rcu_read_lock calls

All verdict handlers make use of the nfnetlink .call_rcu callback
so rcu readlock is already held.
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent ed78d09d
...@@ -124,22 +124,20 @@ int nf_queue(struct sk_buff *skb, ...@@ -124,22 +124,20 @@ int nf_queue(struct sk_buff *skb,
const struct nf_queue_handler *qh; const struct nf_queue_handler *qh;
/* QUEUE == DROP if no one is waiting, to be safe. */ /* QUEUE == DROP if no one is waiting, to be safe. */
rcu_read_lock();
qh = rcu_dereference(queue_handler); qh = rcu_dereference(queue_handler);
if (!qh) { if (!qh) {
status = -ESRCH; status = -ESRCH;
goto err_unlock; goto err;
} }
afinfo = nf_get_afinfo(state->pf); afinfo = nf_get_afinfo(state->pf);
if (!afinfo) if (!afinfo)
goto err_unlock; goto err;
entry = kmalloc(sizeof(*entry) + afinfo->route_key_size, GFP_ATOMIC); entry = kmalloc(sizeof(*entry) + afinfo->route_key_size, GFP_ATOMIC);
if (!entry) { if (!entry) {
status = -ENOMEM; status = -ENOMEM;
goto err_unlock; goto err;
} }
*entry = (struct nf_queue_entry) { *entry = (struct nf_queue_entry) {
...@@ -154,8 +152,6 @@ int nf_queue(struct sk_buff *skb, ...@@ -154,8 +152,6 @@ int nf_queue(struct sk_buff *skb,
afinfo->saveroute(skb, entry); afinfo->saveroute(skb, entry);
status = qh->outfn(entry, queuenum); status = qh->outfn(entry, queuenum);
rcu_read_unlock();
if (status < 0) { if (status < 0) {
nf_queue_entry_release_refs(entry); nf_queue_entry_release_refs(entry);
goto err; goto err;
...@@ -163,8 +159,6 @@ int nf_queue(struct sk_buff *skb, ...@@ -163,8 +159,6 @@ int nf_queue(struct sk_buff *skb,
return 0; return 0;
err_unlock:
rcu_read_unlock();
err: err:
kfree(entry); kfree(entry);
return status; return status;
...@@ -177,8 +171,6 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) ...@@ -177,8 +171,6 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
const struct nf_afinfo *afinfo; const struct nf_afinfo *afinfo;
int err; int err;
rcu_read_lock();
nf_queue_entry_release_refs(entry); nf_queue_entry_release_refs(entry);
/* Continue traversal iff userspace said ok... */ /* Continue traversal iff userspace said ok... */
...@@ -221,7 +213,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict) ...@@ -221,7 +213,7 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
default: default:
kfree_skb(skb); kfree_skb(skb);
} }
rcu_read_unlock();
kfree(entry); kfree(entry);
} }
EXPORT_SYMBOL(nf_reinject); EXPORT_SYMBOL(nf_reinject);
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