/[linux-patches]/genpatches-2.6/trunk/2.6.14/1128_3_nat-refcount.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.14/1128_3_nat-refcount.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 292 - (show annotations) (download) (as text)
Tue Jan 31 21:50:53 2006 UTC (14 years, 9 months ago) by johnm
File MIME type: text/x-diff
File size: 1899 byte(s)
Large update - thanks goes to Kerin Millar for the legwork.
1 From stable-bounces@linux.kernel.org Tue Nov 15 04:33:04 2005
2 Date: Tue, 15 Nov 2005 13:32:36 +0100
3 From: Harald Welte <laforge@netfilter.org>
4 To: Stable Kernel <stable@kernel.org>
5 Cc:
6 Subject: [PATCH] [NETFILTER] NAT: Fix module refcount dropping too far
7
8 From: Rusty Rusty <rusty@rustcorp.com.au>
9
10 The unknown protocol is used as a fallback when a protocol isn't known.
11 Hence we cannot handle it failing, so don't set ".me". It's OK, since we
12 only grab a reference from within the same module (iptable_nat.ko), so we
13 never take the module refcount from 0 to 1.
14
15 Also, remove the "protocol is NULL" test: it's never NULL.
16
17 Signed-off-by: Rusty Rusty <rusty@rustcorp.com.au>
18 Signed-off-by: Harald Welte <laforge@netfilter.org>
19 Signed-off-by: Chris Wright <chrisw@osdl.org>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21 ---
22 net/ipv4/netfilter/ip_nat_core.c | 6 ++----
23 net/ipv4/netfilter/ip_nat_proto_unknown.c | 2 +-
24 2 files changed, 3 insertions(+), 5 deletions(-)
25
26 --- linux-2.6.14.2.orig/net/ipv4/netfilter/ip_nat_core.c
27 +++ linux-2.6.14.2/net/ipv4/netfilter/ip_nat_core.c
28 @@ -66,10 +66,8 @@ ip_nat_proto_find_get(u_int8_t protonum)
29 * removed until we've grabbed the reference */
30 preempt_disable();
31 p = __ip_nat_proto_find(protonum);
32 - if (p) {
33 - if (!try_module_get(p->me))
34 - p = &ip_nat_unknown_protocol;
35 - }
36 + if (!try_module_get(p->me))
37 + p = &ip_nat_unknown_protocol;
38 preempt_enable();
39
40 return p;
41 --- linux-2.6.14.2.orig/net/ipv4/netfilter/ip_nat_proto_unknown.c
42 +++ linux-2.6.14.2/net/ipv4/netfilter/ip_nat_proto_unknown.c
43 @@ -62,7 +62,7 @@ unknown_print_range(char *buffer, const
44
45 struct ip_nat_protocol ip_nat_unknown_protocol = {
46 .name = "unknown",
47 - .me = THIS_MODULE,
48 + /* .me isn't set: getting a ref to this cannot fail. */
49 .manip_pkt = unknown_manip_pkt,
50 .in_range = unknown_in_range,
51 .unique_tuple = unknown_unique_tuple,

  ViewVC Help
Powered by ViewVC 1.1.20