Commit 5808e76e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] slab: print stuff when the wrong cache is used

From: Manfred Spraul <manfred@colorfullife.com>

Some extra diagnostics when someone passes the wrong object type
into kmem_cache_free().  To help some bug which Manfred is chasing.
parent 234ed735
......@@ -1628,7 +1628,13 @@ static inline void *cache_free_debugcheck (kmem_cache_t * cachep, void * objp, v
kfree_debugcheck(objp);
page = virt_to_page(objp);
BUG_ON(GET_PAGE_CACHE(page) != cachep);
if (GET_PAGE_CACHE(page) != cachep) {
printk(KERN_ERR "mismatch in kmem_cache_free: expected cache %p, got %p\n",
GET_PAGE_CACHE(page),cachep);
printk(KERN_ERR "%p is %s.\n", cachep, cachep->name);
printk(KERN_ERR "%p is %s.\n", GET_PAGE_CACHE(page), GET_PAGE_CACHE(page)->name);
WARN_ON(1);
}
slabp = GET_PAGE_SLAB(page);
if (cachep->flags & SLAB_STORE_USER) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment