diff options
author | Christoph Lameter <clameter@sgi.com> | 2008-05-28 13:32:22 -0400 |
---|---|---|
committer | Pekka Enberg <penberg@cs.helsinki.fi> | 2008-07-15 13:36:01 -0400 |
commit | 0937502af7c9b648ed4e884ccb7f504b01a005a1 (patch) | |
tree | 25ed40b554b3c5e5e8a34351b38ccffe336a1b40 /mm/slub.c | |
parent | 4d3702b62e004172f44870763cf56793d8de0cbf (diff) |
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.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -2766,6 +2766,7 @@ void kfree(const void *x) | |||
2766 | 2766 | ||
2767 | page = virt_to_head_page(x); | 2767 | page = virt_to_head_page(x); |
2768 | if (unlikely(!PageSlab(page))) { | 2768 | if (unlikely(!PageSlab(page))) { |
2769 | BUG_ON(!PageCompound(page)); | ||
2769 | put_page(page); | 2770 | put_page(page); |
2770 | return; | 2771 | return; |
2771 | } | 2772 | } |