All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: davem@davemloft.net
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 01/07]: nf_conntrack: Fix module refcount dropping too far
Date: Fri, 21 Apr 2006 03:06:49 +0200 (MEST)	[thread overview]
Message-ID: <20060421010649.8466.48853.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20060421010648.8466.94593.sendpatchset@localhost.localdomain>

[NETFILTER]: nf_conntrack: Fix module refcount dropping too far

If nf_ct_l3proto_find_get() fails to get the refcount of
nf_ct_l3proto_generic, nf_ct_l3proto_put() will drop the refcount
too far.

This gets rid of '.me = THIS_MODULE' of nf_ct_l3proto_generic so that
nf_ct_l3proto_find_get() doesn't try to get refcount of it.
It's OK because its symbol is usable until nf_conntrack.ko is unloaded.

This also kills unnecessary NULL pointer check as well.
__nf_ct_proto_find() allways returns non-NULL pointer.

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit bc79a39fcc0cb09ed73ba0052cb87c2893f4f65f
tree a2702573ee2acdc6fb865921a94042ef8d14f0f5
parent 5a7b46b369419493bab4de67b1526e9f76b22a7f
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Fri, 21 Apr 2006 01:19:00 +0200
committer Patrick McHardy <kaber@trash.net> Fri, 21 Apr 2006 01:19:00 +0200

 net/netfilter/nf_conntrack_core.c            |   12 ++++--------
 net/netfilter/nf_conntrack_l3proto_generic.c |    1 -
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
index e581190..e302222 100644
--- a/net/netfilter/nf_conntrack_core.c
+++ b/net/netfilter/nf_conntrack_core.c
@@ -208,10 +208,8 @@ nf_ct_proto_find_get(u_int16_t l3proto, 
 
 	preempt_disable();
 	p = __nf_ct_proto_find(l3proto, protocol);
-	if (p) {
-		if (!try_module_get(p->me))
-			p = &nf_conntrack_generic_protocol;
-	}
+	if (!try_module_get(p->me))
+		p = &nf_conntrack_generic_protocol;
 	preempt_enable();
 	
 	return p;
@@ -229,10 +227,8 @@ nf_ct_l3proto_find_get(u_int16_t l3proto
 
 	preempt_disable();
 	p = __nf_ct_l3proto_find(l3proto);
-	if (p) {
-		if (!try_module_get(p->me))
-			p = &nf_conntrack_generic_l3proto;
-	}
+	if (!try_module_get(p->me))
+		p = &nf_conntrack_generic_l3proto;
 	preempt_enable();
 
 	return p;
diff --git a/net/netfilter/nf_conntrack_l3proto_generic.c b/net/netfilter/nf_conntrack_l3proto_generic.c
index 7de4f06..3fc58e4 100644
--- a/net/netfilter/nf_conntrack_l3proto_generic.c
+++ b/net/netfilter/nf_conntrack_l3proto_generic.c
@@ -94,5 +94,4 @@ struct nf_conntrack_l3proto nf_conntrack
 	.print_conntrack = generic_print_conntrack,
 	.prepare	 = generic_prepare,
 	.get_features	 = generic_get_features,
-	.me		 = THIS_MODULE,
 };

  reply	other threads:[~2006-04-21  1:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-21  1:06 [NETFILTER 00/07]: Netfilter fixes for 2.6.17 Patrick McHardy
2006-04-21  1:06 ` Patrick McHardy [this message]
2006-04-21  1:06 ` [NETFILTER 02/07]: ULOG target is not obsolete Patrick McHardy
2006-04-21  1:06 ` [NETFILTER 03/07]: Fix compat_xt_counters alignment for non-x86 Patrick McHardy
2006-04-21  1:06 ` [NETFILTER 04/07]: nf_conntrack: kill unused callback init_conntrack Patrick McHardy
2006-04-21  1:06 ` [NETFILTER 05/07]: ip6_tables: remove broken comefrom debugging Patrick McHardy
2006-04-21  1:06 ` [NETFILTER 06/07]: x_tables: move table->lock initialization Patrick McHardy
2006-04-21  1:06 ` [NETFILTER 07/07]: ipt action: use xt_check_target for basic verification Patrick McHardy
2006-04-25  0:54 ` [NETFILTER 00/07]: Netfilter fixes for 2.6.17 David S. Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060421010649.8466.48853.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.