All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nf_conntrack: Fix module refcount dropping too far
@ 2006-04-07  8:59 Yasuyuki KOZAKAI
  0 siblings, 0 replies; 4+ messages in thread
From: Yasuyuki KOZAKAI @ 2006-04-07  8:59 UTC (permalink / raw)
  To: netfilter-devel; +Cc: laforge, kaber

[-- Attachment #1: Type: Text/Plain, Size: 307 bytes --]


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. Only nf_ct_l3proto_generic has this problem.

This fix is missing synchronization with ip_conntrack at the last minutes,
but it's not critical, I think.

-- Yasuyuki Kozakai

[-- Attachment #2: 01-generic-refcnt.patch --]
[-- Type: Text/Plain, Size: 2341 bytes --]

[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>

---
commit e2a1cbe4dda205181d6206df84fe3eb22ec85273
tree 01324536d3cf7d405dfddbb954ea155bed8a64af
parent a8b9aa85685a7f5c5841dfc4c5772d453fbf5776
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Fri, 07 Apr 2006 14:54:25 +0900
committer Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Fri, 07 Apr 2006 14:54:25 +0900

 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 56389c8..54bdc08 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,
 };

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH] nf_conntrack: Fix module refcount dropping too far
@ 2006-02-08  9:54 Yasuyuki KOZAKAI
  2006-02-08 10:00 ` Yasuyuki KOZAKAI
  0 siblings, 1 reply; 4+ messages in thread
From: Yasuyuki KOZAKAI @ 2006-02-08  9:54 UTC (permalink / raw)
  To: netfilter-devel


Hi,

This is missing port from ip_conntrack, and prevents
nf_conntrack_l3proto_find_get() from taking refcount of
nf_conntrack_l3proto_generic to fix refcount underflow.

Regards,

-- Yasuyuki Kozakai

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-07 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <200604070859.k378xiNM009770@toshiba.co.jp>
2006-04-07 12:43 ` [PATCH] nf_conntrack: Fix module refcount dropping too far Patrick McHardy
2006-04-07  8:59 Yasuyuki KOZAKAI
  -- strict thread matches above, loose matches on Subject: below --
2006-02-08  9:54 Yasuyuki KOZAKAI
2006-02-08 10:00 ` Yasuyuki KOZAKAI

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.