Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb
Commit:     a014bc8f0f0a3a0cac4fef656f101cdfb77b71eb
Parent:     e3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735
Author:     Pavel Emelyanov <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 4 00:43:24 2007 -0800
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Dec 5 05:37:26 2007 -0800

    [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 <[EMAIL PROTECTED]>
    Acked-by: Simon Horman <[EMAIL PROTECTED]>
    Signed-off-by: David S. Miller <[EMAIL PROTECTED]>
---
 net/ipv4/ipvs/ip_vs_lblc.c  |    7 ++++++-
 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 b843a11..ad89644 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 =
 
 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;
 }
 
 
diff --git a/net/ipv4/ipvs/ip_vs_lblcr.c b/net/ipv4/ipvs/ip_vs_lblcr.c
index e5b323a..2a5ed85 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 =
 
 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;
 }
 
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to