Commit 0937502a authored by Christoph Lameter's avatar Christoph Lameter Committed by Pekka Enberg

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: default avatarChristoph Lameter <clameter@sgi.com>
Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
parent 4d3702b6
...@@ -2766,6 +2766,7 @@ void kfree(const void *x) ...@@ -2766,6 +2766,7 @@ void kfree(const void *x)
page = virt_to_head_page(x); page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) { if (unlikely(!PageSlab(page))) {
BUG_ON(!PageCompound(page));
put_page(page); put_page(page);
return; return;
} }
......
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