aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/netfilter/ip_nat_core.c
diff options
context:
space:
mode:
authorHarald Welte <laforge@netfilter.org>2005-11-03 20:17:51 +0100
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-11-05 01:23:34 -0200
commitd2a7bb7141a1fac7b11523538b2d2407e928baeb (patch)
tree67fdabbfbdc0b53154a4f6aa1a33c383db02bfb2 /net/ipv4/netfilter/ip_nat_core.c
parent[NETFILTER] PPTP helper: Fix endianness bug in GRE key / CallID NAT (diff)
downloadlinux-dev-d2a7bb7141a1fac7b11523538b2d2407e928baeb.tar.xz
linux-dev-d2a7bb7141a1fac7b11523538b2d2407e928baeb.zip
[NETFILTER] NAT: Fix module refcount dropping too far
The unknown protocol is used as a fallback when a protocol isn't known. Hence we cannot handle it failing, so don't set ".me". It's OK, since we only grab a reference from within the same module (iptable_nat.ko), so we never take the module refcount from 0 to 1. Also, remove the "protocol is NULL" test: it's never NULL. Signed-off-by: Rusty Rusty <rusty@rustcorp.com.au> Signed-off-by: Harald Welte <laforge@netfilter.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to '')
-rw-r--r--net/ipv4/netfilter/ip_nat_core.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/net/ipv4/netfilter/ip_nat_core.c b/net/ipv4/netfilter/ip_nat_core.c
index c5e3abd24672..762f4d93936b 100644
--- a/net/ipv4/netfilter/ip_nat_core.c
+++ b/net/ipv4/netfilter/ip_nat_core.c
@@ -66,10 +66,8 @@ ip_nat_proto_find_get(u_int8_t protonum)
* removed until we've grabbed the reference */
preempt_disable();
p = __ip_nat_proto_find(protonum);
- if (p) {
- if (!try_module_get(p->me))
- p = &ip_nat_unknown_protocol;
- }
+ if (!try_module_get(p->me))
+ p = &ip_nat_unknown_protocol;
preempt_enable();
return p;