From: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
To: kernel-janitors@vger.kernel.org
Subject: Re: [Kernel-janitors] Re: 2.6.1: net/ipv4/fib_hash.c: check kme
Date: Thu, 19 Feb 2004 01:30:28 +0000 [thread overview]
Message-ID: <20040219013028.GO29263@conectiva.com.br> (raw)
In-Reply-To: <20040217095525.GD29263@conectiva.com.br>
Em Thu, Feb 19, 2004 at 01:33:25AM +0100, Francois Romieu escreveu:
> Arnaldo Carvalho de Melo <acme@conectiva.com.br> :
> > Seems ok. But I'm picky... see below
>
> Funny: I thought about it as well first :o)
:-) Done deal with me! Thank you guys
>
> kmem_cache_create leak.
>
> Note: fib_hash_init() can be called many times.
>
>
> net/ipv4/fib_hash.c | 19 ++++++++++++++-----
> 1 files changed, 14 insertions(+), 5 deletions(-)
>
> diff -puN net/ipv4/fib_hash.c~janitor-fib_hash_init-bad-cache-free net/ipv4/fib_hash.c
> --- linux-2.6.3/net/ipv4/fib_hash.c~janitor-fib_hash_init-bad-cache-free 2004-02-18 23:40:02.000000000 +0100
> +++ linux-2.6.3-fr/net/ipv4/fib_hash.c 2004-02-19 01:17:01.000000000 +0100
> @@ -871,15 +871,18 @@ struct fib_table * __init fib_hash_init(
> {
> struct fib_table *tb;
>
> - if (fn_hash_kmem = NULL)
> + tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL);
> + if (!tb)
> + goto err_out;
> +
> + if (!fn_hash_kmem) {
> fn_hash_kmem = kmem_cache_create("ip_fib_hash",
> sizeof(struct fib_node),
> 0, SLAB_HWCACHE_ALIGN,
> NULL, NULL);
> -
> - tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL);
> - if (tb = NULL)
> - return NULL;
> + if (!fn_hash_kmem)
> + goto err_free;
> + }
>
> tb->tb_id = id;
> tb->tb_lookup = fn_hash_lookup;
> @@ -889,7 +892,13 @@ struct fib_table * __init fib_hash_init(
> tb->tb_select_default = fn_hash_select_default;
> tb->tb_dump = fn_hash_dump;
> memset(tb->tb_data, 0, sizeof(struct fn_hash));
> +err_out:
> return tb;
> +
> +err_free:
> + kfree(tb);
> + tb = NULL;
> + goto err_out;
> }
>
> /* ------------------------------------------------------------------------ */
>
> _
>
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors
next prev parent reply other threads:[~2004-02-19 1:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-02-17 9:55 [Kernel-janitors] Re: 2.6.1: net/ipv4/fib_hash.c: check kmem_cache Arnaldo Carvalho de Melo
2004-02-17 10:54 ` [Kernel-janitors] Re: 2.6.1: net/ipv4/fib_hash.c: check kme Arnaldo Carvalho de Melo
2004-02-17 17:24 ` Randy.Dunlap
2004-02-18 21:48 ` Francois Romieu
2004-02-19 0:32 ` Arnaldo Carvalho de Melo
2004-02-19 0:33 ` Francois Romieu
2004-02-19 1:30 ` Arnaldo Carvalho de Melo [this message]
2004-02-19 23:02 ` Re: [Kernel-janitors] Re: 2.6.1: net/ipv4/fib_hash.c: check Francois Romieu
2004-02-24 21:53 ` Randy.Dunlap
2004-02-24 22:58 ` Francois Romieu
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=20040219013028.GO29263@conectiva.com.br \
--to=acme@conectiva.com.br \
--cc=kernel-janitors@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.