Re: Bug in kmem_cache_create with duplicate names

From: Steven Rostedt (rostedt_at_goodmis.org)
Date: 12/07/04

  • Next message: Mark Haverkamp: "Re: Rereading disk geometry without reboot"
    To: Arjan van de Ven <arjan@infradead.org>
    Date:	Tue, 07 Dec 2004 11:31:19 -0500
    
    

    On Tue, 2004-12-07 at 11:15 -0500, Arjan van de Ven wrote:

    > > However, I agree with you. I don't see a good reason for it.
    >
    > I do...
    > because if the registration gives success..... then you unregister it
    > later during module unload and the INITIAL user goes bang.
    > It's a bad bug. Don't do it. Fix your code ;)
    >

    Your module should fail to load if you can't register a cache. If you
    are a good boy and check your return codes from the kmem_cache_create,
    you would know that the cache failed and not load the module.
    Otherwise, if it failed for other reasons, then you can be causing bugs
    later when you go to use it.

    Now this raises the issue of name space, this will bug if two modules
    use the same cache name. If this happens with two different vendors,
    than the poor user will have to figure out who to blame.

    -- Steve

    (Arjan, Sorry for the duplicate, I forgot to do a reply all)
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/


  • Next message: Mark Haverkamp: "Re: Rereading disk geometry without reboot"

    Relevant Pages

    • Re: Bug in kmem_cache_create with duplicate names
      ... >Your module should fail to load if you can't register a cache. ... This BUG specifically means that you allocated ... and/or exempt from disclosure under applicable law. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • RE: RFC: Cleanup / small fixes to hugetlb fault handling
      ... David Gibson wrote on Tuesday, October 25, 2005 7:49 PM ... rather than finding it in the page cache already. ... I don't see a bug that you are seeing. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: [PATCH] autofs4 deadlock during expire - kernel 2.6
      ... On Wed, 24 Sep 2003, Arjan van de Ven wrote: ... > this really really looks like you're trying to pamper over a bug by ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: Bug in kmem_cache_create with duplicate names
      ... > Is it really necessary to BUG on creating a cache with a duplicate name? ... Duplicate name can just return NULL. ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)
    • Re: clone() <-> getpid() bug in 2.6?
      ... On Sat, 5 Jun 2004, Arjan van de Ven wrote: ... or glibc internally caches the getpidresult and doesn't notice the ... You can't just invalidate the cache ... send the line "unsubscribe linux-kernel" in ...
      (Linux-Kernel)