diff options
author | J. R. Okajima <hooanon05@yahoo.co.jp> | 2009-12-02 02:55:50 -0500 |
---|---|---|
committer | Pekka Enberg <penberg@cs.helsinki.fi> | 2009-12-06 03:24:03 -0500 |
commit | ddbf2e8366f2a7fa3419be418cfd83a914d2527f (patch) | |
tree | eb5780e7a91ccae58f7754e13627804f5f893320 /mm/slab.c | |
parent | f3d8b53a3abbfd0b74fa5dfaa690870d9619fad9 (diff) |
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 <catalin.marinas@arm.com>
Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm/slab.c')
-rw-r--r-- | mm/slab.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -3103,6 +3103,11 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags) | |||
3103 | } else { | 3103 | } else { |
3104 | STATS_INC_ALLOCMISS(cachep); | 3104 | STATS_INC_ALLOCMISS(cachep); |
3105 | objp = cache_alloc_refill(cachep, flags); | 3105 | objp = cache_alloc_refill(cachep, flags); |
3106 | /* | ||
3107 | * the 'ac' may be updated by cache_alloc_refill(), | ||
3108 | * and kmemleak_erase() requires its correct value. | ||
3109 | */ | ||
3110 | ac = cpu_cache_get(cachep); | ||
3106 | } | 3111 | } |
3107 | /* | 3112 | /* |
3108 | * To avoid a false negative, if an object that is in one of the | 3113 | * To avoid a false negative, if an object that is in one of the |