Skip to content

Commit

Permalink
slub: Add check for kfree() of non slab objects.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Christoph Lameter authored and Pekka Enberg committed Jul 15, 2008
1 parent 4d3702b commit 0937502
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/slub.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 0937502

Please sign in to comment.