linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Pekka Enberg <penberg@cs.helsinki.fi>
To: Christoph Lameter <clameter@sgi.com>
Cc: mpm@selenic.com, linux-mm@kvack.org
Subject: Re: slub: Add check for kfree() of non slab objects.
Date: Wed, 28 May 2008 22:40:11 +0300	[thread overview]
Message-ID: <483DB51B.3010003@cs.helsinki.fi> (raw)
In-Reply-To: <Pine.LNX.4.64.0805281031120.22637@schroedinger.engr.sgi.com>

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>

      reply	other threads:[~2008-05-28 19:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 17:32 Christoph Lameter
2008-05-28 19:40 ` Pekka Enberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=483DB51B.3010003@cs.helsinki.fi \
    --to=penberg@cs.helsinki.fi \
    --cc=clameter@sgi.com \
    --cc=linux-mm@kvack.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox