* [PATCH 1/1] netfilter: do not propagate nf_queue errors in nf_hook_slow
@ 2011-10-31 11:20 Florian Westphal
2011-11-01 9:11 ` Pablo Neira Ayuso
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2011-10-31 11:20 UTC (permalink / raw)
To: netfilter-devel; +Cc: Florian Westphal
commit f15850861860636c905b33a9a5be3dcbc2b0d56a
(netfilter: nfnetlink_queue: return error number to caller)
erronously assigns the return value of nf_queue() to the "ret" value.
This can cause bogus return values if we encounter QUEUE verdict
when bypassing is enabled, the listener does not exist and the
next hook returns NF_STOLEN.
In this case nf_hook_slow returned -ESRCH instead of 0.
Signed-off-by: Florian Westphal <fw@strlen.de>
---
net/netfilter/core.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/net/netfilter/core.c b/net/netfilter/core.c
index 3346829..afca6c7 100644
--- a/net/netfilter/core.c
+++ b/net/netfilter/core.c
@@ -180,17 +180,16 @@ next_hook:
if (ret == 0)
ret = -EPERM;
} else if ((verdict & NF_VERDICT_MASK) == NF_QUEUE) {
- ret = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
- verdict >> NF_VERDICT_QBITS);
- if (ret < 0) {
- if (ret == -ECANCELED)
+ int err = nf_queue(skb, elem, pf, hook, indev, outdev, okfn,
+ verdict >> NF_VERDICT_QBITS);
+ if (err < 0) {
+ if (err == -ECANCELED)
goto next_hook;
- if (ret == -ESRCH &&
+ if (err == -ESRCH &&
(verdict & NF_VERDICT_FLAG_QUEUE_BYPASS))
goto next_hook;
kfree_skb(skb);
}
- ret = 0;
}
rcu_read_unlock();
return ret;
--
1.7.3.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] netfilter: do not propagate nf_queue errors in nf_hook_slow
2011-10-31 11:20 [PATCH 1/1] netfilter: do not propagate nf_queue errors in nf_hook_slow Florian Westphal
@ 2011-11-01 9:11 ` Pablo Neira Ayuso
0 siblings, 0 replies; 2+ messages in thread
From: Pablo Neira Ayuso @ 2011-11-01 9:11 UTC (permalink / raw)
To: Florian Westphal; +Cc: netfilter-devel
On Mon, Oct 31, 2011 at 12:20:16PM +0100, Florian Westphal wrote:
> commit f15850861860636c905b33a9a5be3dcbc2b0d56a
> (netfilter: nfnetlink_queue: return error number to caller)
> erronously assigns the return value of nf_queue() to the "ret" value.
>
> This can cause bogus return values if we encounter QUEUE verdict
> when bypassing is enabled, the listener does not exist and the
> next hook returns NF_STOLEN.
>
> In this case nf_hook_slow returned -ESRCH instead of 0.
>
> Signed-off-by: Florian Westphal <fw@strlen.de>
Applied, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-01 9:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-31 11:20 [PATCH 1/1] netfilter: do not propagate nf_queue errors in nf_hook_slow Florian Westphal
2011-11-01 9:11 ` Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).