From: J. R. Okajima Date: Wed, 2 Dec 2009 07:55:50 +0000 (+0900) Subject: slab, kmemleak: pass the correct pointer to kmemleak_erase() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ddbf2e8366f2a7fa3419be418cfd83a914d2527f;p=mv-sheeva.git slab, kmemleak: pass the correct pointer to kmemleak_erase() In ____cache_alloc(), the variable 'ac' may be changed after cache_alloc_refill() and the following kmemleak_erase() may get an incorrect pointer. Update 'ac' after cache_alloc_refill() unconditionally. See the following URL for the discussion of this patch: http://marc.info/?l=linux-kernel&m=125873373124187&w=2 Acked-by: Catalin Marinas Signed-off-by: J. R. Okajima Signed-off-by: Pekka Enberg --- diff --git a/mm/slab.c b/mm/slab.c index 4e61449d794..66e90477a4b 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -3103,6 +3103,11 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags) } else { STATS_INC_ALLOCMISS(cachep); objp = cache_alloc_refill(cachep, flags); + /* + * the 'ac' may be updated by cache_alloc_refill(), + * and kmemleak_erase() requires its correct value. + */ + ac = cpu_cache_get(cachep); } /* * To avoid a false negative, if an object that is in one of the