netdev
[Top] [All Lists]

Re: [patch-kj] net/ipv4/fib_hash.c: check kmem_cache_create()

To: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" <yoshfuji@xxxxxxxxxxxxxx>
Subject: Re: [patch-kj] net/ipv4/fib_hash.c: check kmem_cache_create()
From: maximilian attems <max@xxxxxxx>
Date: Mon, 21 Jun 2004 22:04:20 +0200
Cc: romieu@xxxxxxxxxxxxx, janitor@xxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
In-reply-to: <20040622.032138.58652005.yoshfuji@xxxxxxxxxxxxxx>
Mail-followup-to: "YOSHIFUJI Hideaki / ?$B5HF#1QL@" <yoshfuji@xxxxxxxxxxxxxx>, romieu@xxxxxxxxxxxxx, janitor@xxxxxxxxxxxxxx, netdev@xxxxxxxxxxx
References: <20040621171832.GE1545@xxxxxxxxxxxxxxx> <20040622.032138.58652005.yoshfuji@xxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mutt/1.5.6+20040523i
On Tue, 22 Jun 2004, YOSHIFUJI Hideaki / ?$B5HF#1QL@ wrote:

> In article <20040621171832.GE1545@xxxxxxxxxxxxxxx> (at Mon, 21 Jun 2004 
> 19:18:32 +0200), maximilian attems <janitor@xxxxxxxxxxxxxx> says:
> 
> > From: Francois Romieu <romieu@xxxxxxxxxxxxx>
> > 
> > kmem_cache_create leak.
> > 
> > Note: fib_hash_init() can be called many times.
> > 
> > Signed-off-by: Maximilian Attems <janitor@xxxxxxxxxxxxxx>
> 
> 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


<Prev in Thread] Current Thread [Next in Thread>