[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1004081159070.21040@chino.kir.corp.google.com>
Date: Thu, 8 Apr 2010 11:59:45 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Pekka Enberg <penberg@...helsinki.fi>
cc: torvalds@...ux-foundation.org, linux-kernel@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>,
Christoph Lameter <cl@...ux-foundation.org>,
Ingo Molnar <mingo@...e.hu>, Matt Mackall <mpm@...enic.com>,
Nick Piggin <npiggin@...e.de>
Subject: Re: [PATCH 2/2] slub: Fix kmem_ptr_validate() for non-kernel
pointers
On Wed, 7 Apr 2010, Pekka Enberg wrote:
> As suggested by Linus, fix up kmem_ptr_validate() to handle non-kernel pointers
> more graciously. The patch changes kmem_ptr_validate() to use the newly
> introduced kern_ptr_validate() helper to check that a pointer is a valid kernel
> pointer before we attempt to convert it into a 'struct page'.
>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: Christoph Lameter <cl@...ux-foundation.org>
> Cc: David Rientjes <rientjes@...gle.com>
Acked-by: David Rientjes <rientjes@...gle.com>
> Cc: Ingo Molnar <mingo@...e.hu>
> Cc: Matt Mackall <mpm@...enic.com>
> Cc: Nick Piggin <npiggin@...e.de>
> Signed-off-by: Pekka Enberg <penberg@...helsinki.fi>
> ---
> mm/slub.c | 3 +++
> 1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/mm/slub.c b/mm/slub.c
> index b364844..7d6c8b1 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2386,6 +2386,9 @@ int kmem_ptr_validate(struct kmem_cache *s, const void *object)
> {
> struct page *page;
>
> + if (!kern_ptr_validate(object, s->size))
> + return 0;
> +
> page = get_object_page(object);
>
> if (!page || s != page->slab)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists