mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-18 06:50:08 +00:00
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>
This commit is contained in:
parent
d110a3942a
commit
d91fc59cd7
@ -79,6 +79,8 @@ struct nf_conntrack_helper *__nf_conntrack_helper_find(const char *name,
|
||||
struct nf_conntrack_helper *nf_conntrack_helper_try_module_get(const char *name,
|
||||
u16 l3num,
|
||||
u8 protonum);
|
||||
void nf_conntrack_helper_put(struct nf_conntrack_helper *helper);
|
||||
|
||||
void nf_ct_helper_init(struct nf_conntrack_helper *helper,
|
||||
u16 l3num, u16 protonum, const char *name,
|
||||
u16 default_port, u16 spec_port, u32 id,
|
||||
|
@ -181,6 +181,12 @@ nf_conntrack_helper_try_module_get(const char *name, u16 l3num, u8 protonum)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_conntrack_helper_try_module_get);
|
||||
|
||||
void nf_conntrack_helper_put(struct nf_conntrack_helper *helper)
|
||||
{
|
||||
module_put(helper->me);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(nf_conntrack_helper_put);
|
||||
|
||||
struct nf_conn_help *
|
||||
nf_ct_helper_ext_add(struct nf_conn *ct,
|
||||
struct nf_conntrack_helper *helper, gfp_t gfp)
|
||||
|
@ -826,9 +826,9 @@ static void nft_ct_helper_obj_destroy(struct nft_object *obj)
|
||||
struct nft_ct_helper_obj *priv = nft_obj_data(obj);
|
||||
|
||||
if (priv->helper4)
|
||||
module_put(priv->helper4->me);
|
||||
nf_conntrack_helper_put(priv->helper4);
|
||||
if (priv->helper6)
|
||||
module_put(priv->helper6->me);
|
||||
nf_conntrack_helper_put(priv->helper6);
|
||||
}
|
||||
|
||||
static void nft_ct_helper_obj_eval(struct nft_object *obj,
|
||||
|
@ -96,7 +96,7 @@ xt_ct_set_helper(struct nf_conn *ct, const char *helper_name,
|
||||
|
||||
help = nf_ct_helper_ext_add(ct, helper, GFP_KERNEL);
|
||||
if (help == NULL) {
|
||||
module_put(helper->me);
|
||||
nf_conntrack_helper_put(helper);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -263,7 +263,7 @@ out:
|
||||
err4:
|
||||
help = nfct_help(ct);
|
||||
if (help)
|
||||
module_put(help->helper->me);
|
||||
nf_conntrack_helper_put(help->helper);
|
||||
err3:
|
||||
nf_ct_tmpl_free(ct);
|
||||
err2:
|
||||
@ -346,7 +346,7 @@ static void xt_ct_tg_destroy(const struct xt_tgdtor_param *par,
|
||||
if (ct) {
|
||||
help = nfct_help(ct);
|
||||
if (help)
|
||||
module_put(help->helper->me);
|
||||
nf_conntrack_helper_put(help->helper);
|
||||
|
||||
nf_ct_netns_put(par->net, par->family);
|
||||
|
||||
|
@ -1123,7 +1123,7 @@ static int ovs_ct_add_helper(struct ovs_conntrack_info *info, const char *name,
|
||||
|
||||
help = nf_ct_helper_ext_add(info->ct, helper, GFP_KERNEL);
|
||||
if (!help) {
|
||||
module_put(helper->me);
|
||||
nf_conntrack_helper_put(helper);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
@ -1584,7 +1584,7 @@ void ovs_ct_free_action(const struct nlattr *a)
|
||||
static void __ovs_ct_free_action(struct ovs_conntrack_info *ct_info)
|
||||
{
|
||||
if (ct_info->helper)
|
||||
module_put(ct_info->helper->me);
|
||||
nf_conntrack_helper_put(ct_info->helper);
|
||||
if (ct_info->ct)
|
||||
nf_ct_tmpl_free(ct_info->ct);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user