summaryrefslogtreecommitdiffstats
path: root/mm/sparse.c
diff options
context:
space:
mode:
authorPekka Enberg2006-06-23 11:03:40 +0200
committerLinus Torvalds2006-06-23 16:42:51 +0200
commitddc2e812d592457747c4367fb73edcaa8e1e49ff (patch)
tree7dc9066c1e43d14f7c495847a9f0b24287806fb2 /mm/sparse.c
parent[PATCH] page migration: Update documentation (diff)
downloadkernel-qcow2-linux-ddc2e812d592457747c4367fb73edcaa8e1e49ff.tar.gz
kernel-qcow2-linux-ddc2e812d592457747c4367fb73edcaa8e1e49ff.tar.xz
kernel-qcow2-linux-ddc2e812d592457747c4367fb73edcaa8e1e49ff.zip
[PATCH] slab: verify pointers before free
Passing an invalid pointer to kfree() and kmem_cache_free() is likely to cause bad memory corruption or even take down the whole system because the bad pointer is likely reused immediately due to the per-CPU caches. Until now, we don't do any verification for this if CONFIG_DEBUG_SLAB is disabled. As suggested by Linus, add PageSlab check to page_to_cache() and page_to_slab() to verify pointers passed to kfree(). Also, move the stronger check from cache_free_debugcheck() to kmem_cache_free() to ensure the passed pointer actually belongs to the cache we're about to free the object. For page_to_cache() and page_to_slab(), the assertions should have virtually no extra cost (two instructions, no data cache pressure) and for kmem_cache_free() the overhead should be minimal. Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Christoph Lameter <clameter@engr.sgi.com> Cc: Linus Torvalds <torvalds@osdl.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/sparse.c')
0 files changed, 0 insertions, 0 deletions