Re: Possible memory leak via slub kmem_cache_create

From: Pekka Enberg
Date: Thu Nov 20 2008 - 13:45:31 EST


Hi Catalin,

On Thu, Nov 20, 2008 at 11:51 AM, Catalin Marinas
<catalin.marinas@xxxxxxx> wrote:
> My point is that the API is slightly different when slub is used since
> kmem_cache_name is no longer guaranteed to return the same pointer
> passed to kmem_cache_create. Maybe a documentation update:
>
> diff --git a/mm/slab.c b/mm/slab.c
> index ea76bcb..9723a72 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -2124,6 +2124,8 @@ static int __init_refok setup_cpu_cache(struct kmem_cache
> *
> * @name must be valid until the cache is destroyed. This implies that
> * the module calling this has to destroy the cache before getting unloaded.
> + * Note that kmem_cache_name() is not guaranteed to return the same pointer,
> + * therefore applications must manage it themselves.

Yes, makes sense. Care to send a patch I can apply?

Pekka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/