linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK
@ 2007-11-29 22:18 Jan Engelhardt
  2007-11-29 22:28 ` Patrick McHardy
  0 siblings, 1 reply; 2+ messages in thread
From: Jan Engelhardt @ 2007-11-29 22:18 UTC (permalink / raw)
  To: kaber
  Cc: Netfilter Developer Mailing List, Linux Kernel Mailing List,
	davem, stable


This one is against davem's net-2.6.25 branch.

===Begins here===

Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK


When xt_CONNMARK is used outside the mangle table and the user specified
"--restore-mark", the connmark_tg_check() function will (correctly)
error out, but (incorrectly) forgets to release the L3 conntrack module.
Same for xt_CONNSECMARK.
Fix is to move the call to acquire the L3 module after the basic 
constraint checks.

Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>

---
 net/netfilter/xt_CONNMARK.c    |   10 +++++-----
 net/netfilter/xt_CONNSECMARK.c |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

Index: linux-2.6/net/netfilter/xt_CONNMARK.c
===================================================================
--- linux-2.6.orig/net/netfilter/xt_CONNMARK.c
+++ linux-2.6/net/netfilter/xt_CONNMARK.c
@@ -81,11 +81,6 @@ connmark_tg_check(const char *tablename,
 {
 	const struct xt_connmark_target_info *matchinfo = targinfo;
 
-	if (nf_ct_l3proto_try_module_get(target->family) < 0) {
-		printk(KERN_WARNING "can't load conntrack support for "
-				    "proto=%d\n", target->family);
-		return false;
-	}
 	if (matchinfo->mode == XT_CONNMARK_RESTORE) {
 		if (strcmp(tablename, "mangle") != 0) {
 			printk(KERN_WARNING "CONNMARK: restore can only be "
@@ -98,6 +93,11 @@ connmark_tg_check(const char *tablename,
 		printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n");
 		return false;
 	}
+	if (nf_ct_l3proto_try_module_get(target->family) < 0) {
+		printk(KERN_WARNING "can't load conntrack support for "
+				    "proto=%d\n", target->family);
+		return false;
+	}
 	return true;
 }
 
Index: linux-2.6/net/netfilter/xt_CONNSECMARK.c
===================================================================
--- linux-2.6.orig/net/netfilter/xt_CONNSECMARK.c
+++ linux-2.6/net/netfilter/xt_CONNSECMARK.c
@@ -91,11 +91,6 @@ connsecmark_tg_check(const char *tablena
 {
 	const struct xt_connsecmark_target_info *info = targinfo;
 
-	if (nf_ct_l3proto_try_module_get(target->family) < 0) {
-		printk(KERN_WARNING "can't load conntrack support for "
-				    "proto=%d\n", target->family);
-		return false;
-	}
 	switch (info->mode) {
 	case CONNSECMARK_SAVE:
 	case CONNSECMARK_RESTORE:
@@ -106,6 +101,11 @@ connsecmark_tg_check(const char *tablena
 		return false;
 	}
 
+	if (nf_ct_l3proto_try_module_get(target->family) < 0) {
+		printk(KERN_WARNING "can't load conntrack support for "
+				    "proto=%d\n", target->family);
+		return false;
+	}
 	return true;
 }
 


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

* Re: [PATCH] Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK
  2007-11-29 22:18 [PATCH] Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK Jan Engelhardt
@ 2007-11-29 22:28 ` Patrick McHardy
  0 siblings, 0 replies; 2+ messages in thread
From: Patrick McHardy @ 2007-11-29 22:28 UTC (permalink / raw)
  To: Jan Engelhardt
  Cc: Netfilter Developer Mailing List, Linux Kernel Mailing List,
	davem, stable

Jan Engelhardt wrote:
> Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK
>
>
> When xt_CONNMARK is used outside the mangle table and the user specified
> "--restore-mark", the connmark_tg_check() function will (correctly)
> error out, but (incorrectly) forgets to release the L3 conntrack module.
> Same for xt_CONNSECMARK.
> Fix is to move the call to acquire the L3 module after the basic 
> constraint checks.
>   

Applied, thanks Jan.


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

end of thread, other threads:[~2007-11-29 22:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-29 22:18 [PATCH] Fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK Jan Engelhardt
2007-11-29 22:28 ` Patrick McHardy

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).