From: Simon Horman <horms@verge.net.au>
To: Pavel Emelyanov <xemul@openvz.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
David Miller <davem@davemloft.net>,
Linux Netdev List <netdev@vger.kernel.org>,
devel@openvz.org, Wensong Zhang <wensong@linux-vs.org>,
Julian Anastasov <ja@ssi.bg>
Subject: Re: [PATCH][IPVS] Don't leak sysctl tables if the scheduler registration fails
Date: Tue, 4 Dec 2007 10:36:48 +0900 [thread overview]
Message-ID: <20071204013647.GB28582@verge.net.au> (raw)
In-Reply-To: <4753D4C5.4040301@openvz.org>
On Mon, Dec 03, 2007 at 01:04:53PM +0300, Pavel Emelyanov wrote:
> In case we load lblc or lblcr module we can leak some sysctl
> tables if the call to register_ip_vs_scheduler() fails.
This looks correct to me.
> 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?
I guess so. Though presumably register_ip_vs_scheduler() could
have other modes of failure in the future.
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Acked-by: Simon Horman <horms@verge.net.au>
> ---
>
> 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;
> }
>
>
--
Horms
next prev parent reply other threads:[~2007-12-04 1:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-03 10:04 [PATCH][IPVS] Don't leak sysctl tables if the scheduler registration fails Pavel Emelyanov
2007-12-04 1:36 ` Simon Horman [this message]
2007-12-04 8:43 ` David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071204013647.GB28582@verge.net.au \
--to=horms@verge.net.au \
--cc=davem@davemloft.net \
--cc=devel@openvz.org \
--cc=herbert@gondor.apana.org.au \
--cc=ja@ssi.bg \
--cc=netdev@vger.kernel.org \
--cc=wensong@linux-vs.org \
--cc=xemul@openvz.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).