Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256540
b: refs/heads/master
c: 84a797d
h: refs/heads/master
v: v3
  • Loading branch information
Eric Dumazet authored and Patrick McHardy committed Jul 18, 2011
1 parent 2437ab2 commit a0bb2ee
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 30 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6b75e3e8d664a9a1b99d31a7f4976ae70d1d090a
refs/heads/master: 84a797dd0b9f7130357b70577fcbda8e638c71a7
41 changes: 12 additions & 29 deletions trunk/net/netfilter/nfnetlink_queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -619,39 +619,26 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
struct nfqnl_instance *queue;
unsigned int verdict;
struct nf_queue_entry *entry;
int err;

rcu_read_lock();
queue = instance_lookup(queue_num);
if (!queue) {
err = -ENODEV;
goto err_out_unlock;
}
if (!queue)
return -ENODEV;

if (queue->peer_pid != NETLINK_CB(skb).pid) {
err = -EPERM;
goto err_out_unlock;
}
if (queue->peer_pid != NETLINK_CB(skb).pid)
return -EPERM;

if (!nfqa[NFQA_VERDICT_HDR]) {
err = -EINVAL;
goto err_out_unlock;
}
if (!nfqa[NFQA_VERDICT_HDR])
return -EINVAL;

vhdr = nla_data(nfqa[NFQA_VERDICT_HDR]);
verdict = ntohl(vhdr->verdict);

if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT) {
err = -EINVAL;
goto err_out_unlock;
}
if ((verdict & NF_VERDICT_MASK) > NF_MAX_VERDICT)
return -EINVAL;

entry = find_dequeue_entry(queue, ntohl(vhdr->id));
if (entry == NULL) {
err = -ENOENT;
goto err_out_unlock;
}
rcu_read_unlock();
if (entry == NULL)
return -ENOENT;

if (nfqa[NFQA_PAYLOAD]) {
if (nfqnl_mangle(nla_data(nfqa[NFQA_PAYLOAD]),
Expand All @@ -664,10 +651,6 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,

nf_reinject(entry, verdict);
return 0;

err_out_unlock:
rcu_read_unlock();
return err;
}

static int
Expand Down Expand Up @@ -780,9 +763,9 @@ nfqnl_recv_config(struct sock *ctnl, struct sk_buff *skb,
}

static const struct nfnl_callback nfqnl_cb[NFQNL_MSG_MAX] = {
[NFQNL_MSG_PACKET] = { .call = nfqnl_recv_unsupp,
[NFQNL_MSG_PACKET] = { .call_rcu = nfqnl_recv_unsupp,
.attr_count = NFQA_MAX, },
[NFQNL_MSG_VERDICT] = { .call = nfqnl_recv_verdict,
[NFQNL_MSG_VERDICT] = { .call_rcu = nfqnl_recv_verdict,
.attr_count = NFQA_MAX,
.policy = nfqa_verdict_policy },
[NFQNL_MSG_CONFIG] = { .call = nfqnl_recv_config,
Expand Down

0 comments on commit a0bb2ee

Please sign in to comment.