netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: maximilian attems <max@stro.at>
To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" <yoshfuji@linux-ipv6.org>
Cc: romieu@fr.zoreil.com, janitor@sternwelten.at, netdev@oss.sgi.com
Subject: Re: [patch-kj] net/ipv4/fib_hash.c: check kmem_cache_create()
Date: Mon, 21 Jun 2004 22:04:20 +0200	[thread overview]
Message-ID: <20040621200420.GI1545@sputnik.stro.at> (raw)
In-Reply-To: <20040622.032138.58652005.yoshfuji@linux-ipv6.org>

On Tue, 22 Jun 2004, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:

> In article <20040621171832.GE1545@sputnik.stro.at> (at Mon, 21 Jun 2004 19:18:32 +0200), maximilian attems <janitor@sternwelten.at> says:
> 
> > From: Francois Romieu <romieu@fr.zoreil.com>
> > 
> > kmem_cache_create leak.
> > 
> > Note: fib_hash_init() can be called many times.
> > 
> > Signed-off-by: Maximilian Attems <janitor@sternwelten.at>
> 
> Please tell us what kind of leakage do you see?
> Is it just enough to return NULL if kmem_cache_create() fails
> like this?
> 
> --- a/net/ipv4/fib_hash.c	10 Nov 2003 23:40:57 -0000	1.1.1.13
> +++ b/net/ipv4/fib_hash.c	21 Jun 2004 18:19:16 -0000
> @@ -871,12 +871,14 @@
>  {
>  	struct fib_table *tb;
>  
> -	if (fn_hash_kmem == NULL)
> +	if (fn_hash_kmem == NULL) {
>  		fn_hash_kmem = kmem_cache_create("ip_fib_hash",
>  						 sizeof(struct fib_node),
>  						 0, SLAB_HWCACHE_ALIGN,
>  						 NULL, NULL);
> -
> +		if (fn_hash_kmem == NULL)
> +			return NULL;
> +	}
>  	tb = kmalloc(sizeof(struct fib_table) + sizeof(struct fn_hash), GFP_KERNEL);
>  	if (tb == NULL)
>  		return NULL;

doesn't seem to be enough,
because if (tb == NULL) fn_hash_kmem won't be freed, 
or am i overseeing something?

a++ maks

  reply	other threads:[~2004-06-21 20:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-21 17:18 [patch-kj] net/ipv4/fib_hash.c: check kmem_cache_create() maximilian attems
2004-06-21 18:21 ` YOSHIFUJI Hideaki / 吉藤英明
2004-06-21 20:04   ` maximilian attems [this message]
2004-06-21 23:51     ` YOSHIFUJI Hideaki / 吉藤英明
  -- strict thread matches above, loose matches on Subject: below --
2004-06-21 23:52 Krishna Kumar

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=20040621200420.GI1545@sputnik.stro.at \
    --to=max@stro.at \
    --cc=janitor@sternwelten.at \
    --cc=netdev@oss.sgi.com \
    --cc=romieu@fr.zoreil.com \
    --cc=yoshfuji@linux-ipv6.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).