summaryrefslogtreecommitdiffstats
path: root/mm/slub.c
diff options
context:
space:
mode:
authorChristoph Lameter <clameter@sgi.com>2008-05-28 19:32:22 +0200
committerPekka Enberg <penberg@cs.helsinki.fi>2008-07-15 19:36:01 +0200
commit0937502af7c9b648ed4e884ccb7f504b01a005a1 (patch)
tree25ed40b554b3c5e5e8a34351b38ccffe336a1b40 /mm/slub.c
parentx86: Rename "ignore" macro in <asm/dwarf2.h> to avoid collision (diff)
downloadlinux-0937502af7c9b648ed4e884ccb7f504b01a005a1.tar.xz
linux-0937502af7c9b648ed4e884ccb7f504b01a005a1.zip
slub: Add check for kfree() of non slab objects.
We can detect kfree()s on non slab objects by checking for PageCompound(). Works in the same way as for ksize. This helped me catch an invalid kfree(). Signed-off-by: Christoph Lameter <clameter@sgi.com> Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Diffstat (limited to 'mm/slub.c')
-rw-r--r--mm/slub.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/mm/slub.c b/mm/slub.c
index 5f6e2c4a2ba7..b3f2e713cdf1 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2766,6 +2766,7 @@ void kfree(const void *x)
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
+ BUG_ON(!PageCompound(page));
put_page(page);
return;
}