Commit 3e3deae8 authored by Jan Engelhardt's avatar Jan Engelhardt Committed by Greg Kroah-Hartman

NETFILTER: fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK

[NETFILTER]: fix forgotten module release in xt_CONNMARK and xt_CONNSECMARK

[ Upstream commit: 67b4af29 ]

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: default avatarJan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 5b5581b7
...@@ -85,11 +85,6 @@ checkentry(const char *tablename, ...@@ -85,11 +85,6 @@ checkentry(const char *tablename,
{ {
const struct xt_connmark_target_info *matchinfo = targinfo; 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 (matchinfo->mode == XT_CONNMARK_RESTORE) {
if (strcmp(tablename, "mangle") != 0) { if (strcmp(tablename, "mangle") != 0) {
printk(KERN_WARNING "CONNMARK: restore can only be " printk(KERN_WARNING "CONNMARK: restore can only be "
...@@ -102,6 +97,11 @@ checkentry(const char *tablename, ...@@ -102,6 +97,11 @@ checkentry(const char *tablename,
printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n"); printk(KERN_WARNING "CONNMARK: Only supports 32bit mark\n");
return false; 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; return true;
} }
......
...@@ -91,11 +91,6 @@ static bool checkentry(const char *tablename, const void *entry, ...@@ -91,11 +91,6 @@ static bool checkentry(const char *tablename, const void *entry,
{ {
const struct xt_connsecmark_target_info *info = targinfo; 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) { switch (info->mode) {
case CONNSECMARK_SAVE: case CONNSECMARK_SAVE:
case CONNSECMARK_RESTORE: case CONNSECMARK_RESTORE:
...@@ -106,6 +101,11 @@ static bool checkentry(const char *tablename, const void *entry, ...@@ -106,6 +101,11 @@ static bool checkentry(const char *tablename, const void *entry,
return false; 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; return true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment