Skip to content
  • Pekka Enberg's avatar
    SLUB: Fix merged slab cache names · 84c1cf62
    Pekka Enberg authored
    
    
    As explained by Linus "I'm Proud to be an American" Torvalds:
    
      Looking at the merging code, I actually think it's totally
      buggy. If you have something like this:
    
       - load module A: create slab cache A
    
       - load module B: create slab cache B that can merge with A
    
       - unload module A
    
       - "cat /proc/slabinfo": BOOM. Oops.
    
      exactly because the name is not handled correctly, and you'll have
      module B holding open a slab cache that has a name pointer that points
      to module A that no longer exists.
    
    This patch fixes the problem by using kstrdup() to allocate dynamic memory for
    ->name of "struct kmem_cache" as suggested by Christoph Lameter.
    
    Acked-by: default avatarChristoph Lameter <cl@linux.com>
    Cc: David Rientjes <rientjes@google.com>
    Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    Signed-off-by: default avatarPekka Enberg <penberg@kernel.org>
    
    Conflicts:
    
    	mm/slub.c
    84c1cf62