From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: <483DB51B.3010003@cs.helsinki.fi> Date: Wed, 28 May 2008 22:40:11 +0300 From: Pekka Enberg MIME-Version: 1.0 Subject: Re: slub: Add check for kfree() of non slab objects. References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: owner-linux-mm@kvack.org Return-Path: To: Christoph Lameter Cc: mpm@selenic.com, linux-mm@kvack.org List-ID: 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 > > 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: email@kvack.org