slab: alien caches must not be initialized if the allocation of the alien cache failed
Subsystems (2)
[email protected]
maintainerPATCH 3/14 slab: alien caches must not be initialized if the allocation of the alien cache failed
From: Christoph Lameter <[email protected]>
Subject: slab: alien caches must not be initialized if the allocation of the alien cache failed
Callers of __alloc_alien() check for NULL. We must do the same check in __alloc_alien_cache to avoid NULL pointer dereferences on allocation failures.
Link http://lkml.kernel.org/r/010001680f42f192-82b4e12e-1565-4ee0-ae1f-1e98974906aa-000000@email.amazonses.com open here
Fixes 49dfc304ba241 ("slab: use the lock on alien_cache, instead of the lock on array_cache")
Fixes c8522a3a5832b ("Slab: introduce alloc_alien")
Signed-off-by Christoph Lameter <[email protected]>
Reported-by [email protected]
Reviewed-by Andrew Morton <[email protected]>
Cc Pekka Enberg <[email protected]>
Cc David Rientjes <[email protected]>
Cc Joonsoo Kim <[email protected]>
Cc <[email protected]>
Signed-off-by Andrew Morton <[email protected]>
---
mm/slab.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
mm/slab.c renamed from mm/slab.c~slab-alien-caches-must-not-be-initialized-if-the-allocation-of-the-alien-cache-failed +4 -2
@@ -666,8 +666,10 @@ static struct alien_cache *__alloc_alienstruct alien_cache *alc =NULL ; alc =kmalloc_node (memsize, gfp, node); -init_arraycache (&alc->ac, entries, batch); -spin_lock_init (&alc->lock); +if (alc) { +init_arraycache (&alc->ac, entries, batch); +spin_lock_init (&alc->lock); + }return alc; }
_