* slub: Add check for kfree() of non slab objects.
@ 2008-05-28 17:32 Christoph Lameter
2008-05-28 19:40 ` Pekka Enberg
0 siblings, 1 reply; 2+ messages in thread
From: Christoph Lameter @ 2008-05-28 17:32 UTC (permalink / raw)
To: Pekka J Enberg; +Cc: mpm, linux-mm
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>
Index: linux-2.6/mm/slub.c
===================================================================
--- linux-2.6.orig/mm/slub.c 2008-05-27 21:28:55.000000000 -0700
+++ linux-2.6/mm/slub.c 2008-05-28 00:04:14.000000000 -0700
@@ -2765,6 +2765,7 @@
page = virt_to_head_page(x);
if (unlikely(!PageSlab(page))) {
+ BUG_ON(!PageCompound(page));
put_page(page);
return;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: slub: Add check for kfree() of non slab objects.
2008-05-28 17:32 slub: Add check for kfree() of non slab objects Christoph Lameter
@ 2008-05-28 19:40 ` Pekka Enberg
0 siblings, 0 replies; 2+ messages in thread
From: Pekka Enberg @ 2008-05-28 19:40 UTC (permalink / raw)
To: Christoph Lameter; +Cc: mpm, linux-mm
Christoph Lameter wrote:
> 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>
>
> Index: linux-2.6/mm/slub.c
> ===================================================================
> --- linux-2.6.orig/mm/slub.c 2008-05-27 21:28:55.000000000 -0700
> +++ linux-2.6/mm/slub.c 2008-05-28 00:04:14.000000000 -0700
> @@ -2765,6 +2765,7 @@
>
> page = virt_to_head_page(x);
> if (unlikely(!PageSlab(page))) {
> + BUG_ON(!PageCompound(page));
> put_page(page);
> return;
> }
Applied, thanks!
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-05-28 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-28 17:32 slub: Add check for kfree() of non slab objects Christoph Lameter
2008-05-28 19:40 ` Pekka Enberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).