[IPVS]: Don't leak sysctl tables if the scheduler registration fails.
In case we load lblc or lblcr module we can leak some sysctl tables if the call to register_ip_vs_scheduler() fails. I've looked at the register_ip_vs_scheduler() code and saw, that the only reason to fail is the name collision, so I think that with some 3rd party schedulers this becomes a relevant issue. No? Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Acked-by: Simon Horman <horms@verge.net.au> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e3c0ac04f9
commit
a014bc8f0f
|
@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
|
|||
|
||||
static int __init ip_vs_lblc_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list);
|
||||
sysctl_header = register_sysctl_table(lblc_root_table);
|
||||
return register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
|
||||
ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler);
|
||||
if (ret)
|
||||
unregister_sysctl_table(sysctl_header);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -769,9 +769,14 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
|
|||
|
||||
static int __init ip_vs_lblcr_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
|
||||
sysctl_header = register_sysctl_table(lblcr_root_table);
|
||||
return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
|
||||
ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler);
|
||||
if (ret)
|
||||
unregister_sysctl_table(sysctl_header);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue