diff options
author | Liping Zhang <zlpnobody@gmail.com> | 2017-05-07 10:01:55 -0400 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-05-15 06:42:29 -0400 |
commit | d91fc59cd77c719f33eda65c194ad8f95a055190 (patch) | |
tree | b39d63460a1b261518ed0fecc72a7ff1cff320c8 /net | |
parent | d110a3942aca78d14929bc648aeb83ee0b245a61 (diff) |
netfilter: introduce nf_conntrack_helper_put helper function
And convert module_put invocation to nf_conntrack_helper_put, this is
prepared for the followup patch, which will add a refcnt for cthelper,
so we can reject the deleting request when cthelper is in use.
Signed-off-by: Liping Zhang <zlpnobody@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_conntrack_helper.c | 6 | ||||
-rw-r--r-- | net/netfilter/nft_ct.c | 4 | ||||
-rw-r--r-- | net/netfilter/xt_CT.c | 6 | ||||
-rw-r--r-- | net/openvswitch/conntrack.c | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/net/netfilter/nf_conntrack_helper.c b/net/netfilter/nf_conntrack_helper.c index 3a60efa7799b..e17006b6e434 100644 --- a/net/netfilter/nf_conntrack_helper.c +++ b/net/netfilter/nf_conntrack_helper.c | |||
@@ -181,6 +181,12 @@ nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum) | |||
181 | } | 181 | } |
182 | EXPORT_SYMBOL_GPL(nf_conntrack_helper_try_module_get); | 182 | EXPORT_SYMBOL_GPL(nf_conntrack_helper_try_module_get); |
183 | 183 | ||
184 | void nf_conntrack_helper_put(struct nf_conntrack_helper *helper) | ||
185 | { | ||
186 | module_put(helper->me); | ||
187 | } | ||
188 | EXPORT_SYMBOL_GPL(nf_conntrack_helper_put); | ||
189 | |||
184 | struct nf_conn_help * | 190 | struct nf_conn_help * |
185 | nf_ct_helper_ext_add(struct nf_conn *ct, | 191 | nf_ct_helper_ext_add(struct nf_conn *ct, |
186 | struct nf_conntrack_helper *helper, gfp_t gfp) | 192 | struct nf_conntrack_helper *helper, gfp_t gfp) |
diff --git a/net/netfilter/nft_ct.c b/net/netfilter/nft_ct.c index a34ceb38fc55..1678e9e75e8e 100644 --- a/net/netfilter/nft_ct.c +++ b/net/netfilter/nft_ct.c | |||
@@ -826,9 +826,9 @@ static void nft_ct_helper_obj_destroy(struct nft_object *obj) | |||
826 | struct nft_ct_helper_obj *priv = nft_obj_data(obj); | 826 | struct nft_ct_helper_obj *priv = nft_obj_data(obj); |
827 | 827 | ||
828 | if (priv->helper4) | 828 | if (priv->helper4) |
829 | module_put(priv->helper4->me); | 829 | nf_conntrack_helper_put(priv->helper4); |
830 | if (priv->helper6) | 830 | if (priv->helper6) |
831 | module_put(priv->helper6->me); | 831 | nf_conntrack_helper_put(priv->helper6); |
832 | } | 832 | } |
833 | 833 | ||
834 | static void nft_ct_helper_obj_eval(struct nft_object *obj, | 834 | static void nft_ct_helper_obj_eval(struct nft_object *obj, |
diff --git a/net/netfilter/xt_CT.c b/net/netfilter/xt_CT.c index bb7ad82dcd56..623ef37de886 100644 --- a/net/netfilter/xt_CT.c +++ b/net/netfilter/xt_CT.c | |||
@@ -96,7 +96,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char *helper_name, | |||
96 | 96 | ||
97 | help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL); | 97 | help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL); |
98 | if (help == NULL) { | 98 | if (help == NULL) { |
99 | module_put(helper->me); | 99 | nf_conntrack_helper_put(helper); |
100 | return -ENOMEM; | 100 | return -ENOMEM; |
101 | } | 101 | } |
102 | 102 | ||
@@ -263,7 +263,7 @@ out: | |||
263 | err4: | 263 | err4: |
264 | help = nfct_help(ct); | 264 | help = nfct_help(ct); |
265 | if (help) | 265 | if (help) |
266 | module_put(help->helper->me); | 266 | nf_conntrack_helper_put(help->helper); |
267 | err3: | 267 | err3: |
268 | nf_ct_tmpl_free(ct); | 268 | nf_ct_tmpl_free(ct); |
269 | err2: | 269 | err2: |
@@ -346,7 +346,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par, | |||
346 | if (ct) { | 346 | if (ct) { |
347 | help = nfct_help(ct); | 347 | help = nfct_help(ct); |
348 | if (help) | 348 | if (help) |
349 | module_put(help->helper->me); | 349 | nf_conntrack_helper_put(help->helper); |
350 | 350 | ||
351 | nf_ct_netns_put(par->net, par->family); | 351 | nf_ct_netns_put(par->net, par->family); |
352 | 352 | ||
diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index bf602e33c40a..08679ebb3068 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c | |||
@@ -1123,7 +1123,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name, | |||
1123 | 1123 | ||
1124 | help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL); | 1124 | help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL); |
1125 | if (!help) { | 1125 | if (!help) { |
1126 | module_put(helper->me); | 1126 | nf_conntrack_helper_put(helper); |
1127 | return -ENOMEM; | 1127 | return -ENOMEM; |
1128 | } | 1128 | } |
1129 | 1129 | ||
@@ -1584,7 +1584,7 @@ void ovs_ct_free_action(const struct nlattr *a) | |||
1584 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) | 1584 | static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info) |
1585 | { | 1585 | { |
1586 | if (ct_info->helper) | 1586 | if (ct_info->helper) |
1587 | module_put(ct_info->helper->me); | 1587 | nf_conntrack_helper_put(ct_info->helper); |
1588 | if (ct_info->ct) | 1588 | if (ct_info->ct) |
1589 | nf_ct_tmpl_free(ct_info->ct); | 1589 | nf_ct_tmpl_free(ct_info->ct); |
1590 | } | 1590 | } |