diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-12-04 03:43:24 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-12-05 08:37:26 -0500 |
commit | a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb (patch) | |
tree | 0b48fdff5525ddba1c64a8c0fd8c8fb6e1a9aeab | |
parent | e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 (diff) |
[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>
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblc.c | 7 | ||||
-rw-r--r-- | net/ipv4/ipvs/ip_vs_lblcr.c | 7 |
2 files changed, 12 insertions, 2 deletions
diff --git a/net/ipv4/ipvs/ip_vs_lblc.c b/net/ipv4/ipvs/ip_vs_lblc.c index b843a11d7cf7..ad89644ef5d2 100644 --- a/net/ipv4/ipvs/ip_vs_lblc.c +++ b/net/ipv4/ipvs/ip_vs_lblc.c | |||
@@ -580,9 +580,14 @@ static struct ip_vs_scheduler ip_vs_lblc_scheduler = | |||
580 | 580 | ||
581 | static int __init ip_vs_lblc_init(void) | 581 | static int __init ip_vs_lblc_init(void) |
582 | { | 582 | { |
583 | int ret; | ||
584 | |||
583 | INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); | 585 | INIT_LIST_HEAD(&ip_vs_lblc_scheduler.n_list); |
584 | sysctl_header = register_sysctl_table(lblc_root_table); | 586 | sysctl_header = register_sysctl_table(lblc_root_table); |
585 | return register_ip_vs_scheduler(&ip_vs_lblc_scheduler); | 587 | ret = register_ip_vs_scheduler(&ip_vs_lblc_scheduler); |
588 | if (ret) | ||
589 | unregister_sysctl_table(sysctl_header); | ||
590 | return ret; | ||
586 | } | 591 | } |
587 | 592 | ||
588 | 593 | ||
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c index e5b323a6b2f7..2a5ed85a3352 100644 --- a/net/ipv4/ipvs/ip_vs_lblcr.c +++ b/net/ipv4/ipvs/ip_vs_lblcr.c | |||
@@ -769,9 +769,14 @@ static struct ip_vs_scheduler ip_vs_lblcr_scheduler = | |||
769 | 769 | ||
770 | static int __init ip_vs_lblcr_init(void) | 770 | static int __init ip_vs_lblcr_init(void) |
771 | { | 771 | { |
772 | int ret; | ||
773 | |||
772 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); | 774 | INIT_LIST_HEAD(&ip_vs_lblcr_scheduler.n_list); |
773 | sysctl_header = register_sysctl_table(lblcr_root_table); | 775 | sysctl_header = register_sysctl_table(lblcr_root_table); |
774 | return register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); | 776 | ret = register_ip_vs_scheduler(&ip_vs_lblcr_scheduler); |
777 | if (ret) | ||
778 | unregister_sysctl_table(sysctl_header); | ||
779 | return ret; | ||
775 | } | 780 | } |
776 | 781 | ||
777 | 782 | ||