]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
NETFILTER: fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK
authorJan Engelhardt <jengelh@computergmbh.de>
Tue, 11 Dec 2007 01:39:40 +0000 (09:39 +0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Dec 2007 17:51:08 +0000 (09:51 -0800)
[NETFILTER]: fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK

[ Upstream commit: 67b4af297033f5f65999885542f95ba7b562848a ]

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>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/netfilter/xt_CONNMARK.c
net/netfilter/xt_CONNSECMARK.c

index 5a00c5444334fe926bd2a8bc995493c1bea574a0..5bc522709a082e133c7cd30099ca6912691a33d6 100644 (file)
@@ -85,11 +85,6 @@ checkentry(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 "
@@ -102,6 +97,11 @@ checkentry(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 63d73138c1b9e6482908a39ad3f1e1e7ceeb5295..23f780d47e639898947d26fcaab680c77c40eb4e 100644 (file)
@@ -91,11 +91,6 @@ static bool checkentry(const char *tablename, const void *entry,
 {
        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 @@ static bool checkentry(const char *tablename, const void *entry,
                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;
 }