Skip to content

Commit 4b3d15e

Browse files
kaberdavem330
authored andcommitted
[NETFILTER]: {nfnetlink,ip,ip6}_queue: kill issue_verdict
Now that issue_verdict doesn't need to free the queue entries anymore, all it does is disable local BHs and call nf_reinject. Move the BH disabling to the okfn invocation in nf_reinject and kill the issue_verdict functions. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 02f014d commit 4b3d15e

File tree

4 files changed

+8
-44
lines changed

4 files changed

+8
-44
lines changed

net/ipv4/netfilter/ip_queue.c

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -49,19 +49,6 @@ static struct sock *ipqnl __read_mostly;
4949
static LIST_HEAD(queue_list);
5050
static DEFINE_MUTEX(ipqnl_mutex);
5151

52-
static void
53-
ipq_issue_verdict(struct nf_queue_entry *entry, int verdict)
54-
{
55-
/* TCP input path (and probably other bits) assume to be called
56-
* from softirq context, not from syscall, like ipq_issue_verdict is
57-
* called. TCP input path deadlocks with locks taken from timer
58-
* softirq, e.g. We therefore emulate this by local_bh_disable() */
59-
60-
local_bh_disable();
61-
nf_reinject(entry, verdict);
62-
local_bh_enable();
63-
}
64-
6552
static inline void
6653
__ipq_enqueue_entry(struct nf_queue_entry *entry)
6754
{
@@ -138,7 +125,7 @@ __ipq_flush(ipq_cmpfn cmpfn, unsigned long data)
138125
if (!cmpfn || cmpfn(entry, data)) {
139126
list_del(&entry->list);
140127
queue_total--;
141-
ipq_issue_verdict(entry, NF_DROP);
128+
nf_reinject(entry, NF_DROP);
142129
}
143130
}
144131
}
@@ -345,7 +332,7 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len)
345332
if (ipq_mangle_ipv4(vmsg, entry) < 0)
346333
verdict = NF_DROP;
347334

348-
ipq_issue_verdict(entry, verdict);
335+
nf_reinject(entry, verdict);
349336
return 0;
350337
}
351338
}

net/ipv6/netfilter/ip6_queue.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,6 @@ static struct sock *ipqnl __read_mostly;
5353
static LIST_HEAD(queue_list);
5454
static DEFINE_MUTEX(ipqnl_mutex);
5555

56-
static void
57-
ipq_issue_verdict(struct nf_queue_entry *entry, int verdict)
58-
{
59-
local_bh_disable();
60-
nf_reinject(entry, verdict);
61-
local_bh_enable();
62-
}
63-
6456
static inline void
6557
__ipq_enqueue_entry(struct nf_queue_entry *entry)
6658
{
@@ -137,7 +129,7 @@ __ipq_flush(ipq_cmpfn cmpfn, unsigned long data)
137129
if (!cmpfn || cmpfn(entry, data)) {
138130
list_del(&entry->list);
139131
queue_total--;
140-
ipq_issue_verdict(entry, NF_DROP);
132+
nf_reinject(entry, NF_DROP);
141133
}
142134
}
143135
}
@@ -343,7 +335,7 @@ ipq_set_verdict(struct ipq_verdict_msg *vmsg, unsigned int len)
343335
if (ipq_mangle_ipv6(vmsg, entry) < 0)
344336
verdict = NF_DROP;
345337

346-
ipq_issue_verdict(entry, verdict);
338+
nf_reinject(entry, verdict);
347339
return 0;
348340
}
349341
}

net/netfilter/nf_queue.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,9 @@ void nf_reinject(struct nf_queue_entry *entry, unsigned int verdict)
275275
switch (verdict & NF_VERDICT_MASK) {
276276
case NF_ACCEPT:
277277
case NF_STOP:
278+
local_bh_disable();
278279
entry->okfn(skb);
280+
local_bh_enable();
279281
case NF_STOLEN:
280282
break;
281283
case NF_QUEUE:

net/netfilter/nfnetlink_queue.c

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -202,23 +202,6 @@ instance_destroy(struct nfqnl_instance *inst)
202202
_instance_destroy2(inst, 1);
203203
}
204204

205-
206-
207-
static void
208-
issue_verdict(struct nf_queue_entry *entry, int verdict)
209-
{
210-
QDEBUG("entering for entry %p, verdict %u\n", entry, verdict);
211-
212-
/* TCP input path (and probably other bits) assume to be called
213-
* from softirq context, not from syscall, like issue_verdict is
214-
* called. TCP input path deadlocks with locks taken from timer
215-
* softirq, e.g. We therefore emulate this by local_bh_disable() */
216-
217-
local_bh_disable();
218-
nf_reinject(entry, verdict);
219-
local_bh_enable();
220-
}
221-
222205
static inline void
223206
__enqueue_entry(struct nfqnl_instance *queue, struct nf_queue_entry *entry)
224207
{
@@ -289,7 +272,7 @@ nfqnl_flush(struct nfqnl_instance *queue, nfqnl_cmpfn cmpfn, unsigned long data)
289272
if (!cmpfn || cmpfn(entry, data)) {
290273
list_del(&entry->list);
291274
queue->queue_total--;
292-
issue_verdict(entry, NF_DROP);
275+
nf_reinject(entry, NF_DROP);
293276
}
294277
}
295278
spin_unlock_bh(&queue->lock);
@@ -761,7 +744,7 @@ nfqnl_recv_verdict(struct sock *ctnl, struct sk_buff *skb,
761744
entry->skb->mark = ntohl(*(__be32 *)
762745
nla_data(nfqa[NFQA_MARK]));
763746

764-
issue_verdict(entry, verdict);
747+
nf_reinject(entry, verdict);
765748
instance_put(queue);
766749
return 0;
767750

0 commit comments

Comments
 (0)