Merge branch 'next' into for-linus
[cascardo/linux.git] / net / netfilter / xt_CT.c
index a51de9b..1160185 100644 (file)
@@ -112,6 +112,8 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par)
                goto err3;
 
        if (info->helper[0]) {
+               struct nf_conntrack_helper *helper;
+
                ret = -ENOENT;
                proto = xt_ct_find_proto(par);
                if (!proto) {
@@ -120,19 +122,21 @@ static int xt_ct_tg_check_v0(const struct xt_tgchk_param *par)
                        goto err3;
                }
 
-               ret = -ENOMEM;
-               help = nf_ct_helper_ext_add(ct, GFP_KERNEL);
-               if (help == NULL)
-                       goto err3;
-
                ret = -ENOENT;
-               help->helper = nf_conntrack_helper_try_module_get(info->helper,
-                                                                 par->family,
-                                                                 proto);
-               if (help->helper == NULL) {
+               helper = nf_conntrack_helper_try_module_get(info->helper,
+                                                           par->family,
+                                                           proto);
+               if (helper == NULL) {
                        pr_info("No such helper \"%s\"\n", info->helper);
                        goto err3;
                }
+
+               ret = -ENOMEM;
+               help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL);
+               if (help == NULL)
+                       goto err3;
+
+               help->helper = helper;
        }
 
        __set_bit(IPS_TEMPLATE_BIT, &ct->status);
@@ -202,6 +206,8 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
                goto err3;
 
        if (info->helper[0]) {
+               struct nf_conntrack_helper *helper;
+
                ret = -ENOENT;
                proto = xt_ct_find_proto(par);
                if (!proto) {
@@ -210,19 +216,21 @@ static int xt_ct_tg_check_v1(const struct xt_tgchk_param *par)
                        goto err3;
                }
 
-               ret = -ENOMEM;
-               help = nf_ct_helper_ext_add(ct, GFP_KERNEL);
-               if (help == NULL)
-                       goto err3;
-
                ret = -ENOENT;
-               help->helper = nf_conntrack_helper_try_module_get(info->helper,
-                                                                 par->family,
-                                                                 proto);
-               if (help->helper == NULL) {
+               helper = nf_conntrack_helper_try_module_get(info->helper,
+                                                           par->family,
+                                                           proto);
+               if (helper == NULL) {
                        pr_info("No such helper \"%s\"\n", info->helper);
                        goto err3;
                }
+
+               ret = -ENOMEM;
+               help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL);
+               if (help == NULL)
+                       goto err3;
+
+               help->helper = helper;
        }
 
 #ifdef CONFIG_NF_CONNTRACK_TIMEOUT