From: Christoph Lameter Date: Wed, 28 May 2008 17:32:22 +0000 (-0700) Subject: slub: Add check for kfree() of non slab objects. X-Git-Tag: v2.6.27-rc1~1075^2~2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=0937502af7c9b648ed4e884ccb7f504b01a005a1;p=linux-2.6-omap-h63xx.git 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 Signed-off-by: Pekka Enberg --- diff --git a/mm/slub.c b/mm/slub.c index 5f6e2c4a2ba..b3f2e713cdf 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; }