Skip to content

Commit

Permalink
netfilter: ipt_CLUSTERIP: put config struct if we can't increment ct …
Browse files Browse the repository at this point in the history
…refcount

This needs to put() the entry to avoid a resource leak in error path.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Florian Westphal authored and Pablo Neira Ayuso committed Feb 25, 2018
1 parent 9cb9c07 commit 8ae5682
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions net/ipv4/netfilter/ipt_CLUSTERIP.c
Original file line number Diff line number Diff line change
Expand Up @@ -496,19 +496,23 @@ static int clusterip_tg_check(const struct xt_tgchk_param *par)
return PTR_ERR(config);
}
}
cipinfo->config = config;

ret = nf_ct_netns_get(par->net, par->family);
if (ret < 0)
if (ret < 0) {
pr_info("cannot load conntrack support for proto=%u\n",
par->family);
clusterip_config_entry_put(par->net, config);
clusterip_config_put(config);
return ret;
}

if (!par->net->xt.clusterip_deprecated_warning) {
pr_info("ipt_CLUSTERIP is deprecated and it will removed soon, "
"use xt_cluster instead\n");
par->net->xt.clusterip_deprecated_warning = true;
}

cipinfo->config = config;
return ret;
}

Expand Down

0 comments on commit 8ae5682

Please sign in to comment.