Commit a014bc8f authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[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: default avatarPavel Emelyanov <xemul@openvz.org>
Acked-by: default avatarSimon Horman <horms@verge.net.au>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e3c0ac04
...@@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = ...@@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler =
static int __init ip_vs_lblc_init(void) static int __init ip_vs_lblc_init(void)
{ {
int ret;
INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list);
sysctl_header = register_sysctl_table(lblc_root_table); 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 = ...@@ -769,9 +769,14 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler =
static int __init ip_vs_lblcr_init(void) static int __init ip_vs_lblcr_init(void)
{ {
int ret;
INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list);
sysctl_header = register_sysctl_table(lblcr_root_table); 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;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment