mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: "J. R. Okajima" <hooanon05@yahoo.co.jp>
Cc: linux-kernel@vger.kernel.org, penberg@cs.helsinki.fi
Subject: Re: [PATCH 2/2] slab, kmemleak, bugfix, pass the correct pointer to kmemleak_erase()
Date: Wed, 02 Dec 2009 09:55:03 +0000	[thread overview]
Message-ID: <tnxmy214s5k.fsf@pc1117.cambridge.arm.com> (raw)
In-Reply-To: <1259740550-10394-3-git-send-email-hooanon05@yahoo.co.jp> (J. R. Okajima's message of "Wed\,  2 Dec 2009 16\:55\:50 +0900")

"J. R. Okajima" <hooanon05@yahoo.co.jp> wrote:
> In ____cache_alloc(), the variable 'ac' may be changed after
> cache_alloc_refill() and the following kmemleak_erase() may get an
> incorrect pointer.
> Update 'ac' after cache_alloc_refill() unconditionally.
> cf. http://marc.info/?l=linux-kernel&m=125873373124187&w=2
>     and its thread.
>
> Cc: Pekka Enberg <penberg@cs.helsinki.fi>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
>
> Signed-off-by: J. R. Okajima <hooanon05@yahoo.co.jp>
> ---
>  mm/slab.c |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/mm/slab.c b/mm/slab.c
> index 4e61449..66e9047 100644
> --- a/mm/slab.c
> +++ b/mm/slab.c
> @@ -3103,6 +3103,11 @@ static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags)
>  	} else {
>  		STATS_INC_ALLOCMISS(cachep);
>  		objp = cache_alloc_refill(cachep, flags);
> +		/*
> +		 * the 'ac' may be updated by cache_alloc_refill(),
> +		 * and kmemleak_erase() requires its correct value.
> +		 */
> +		ac = cpu_cache_get(cachep);
>  	}
>  	/*
>  	 * To avoid a false negative, if an object that is in one of the

Acked-by: Catalin Marinas <catalin.marinas@arm.com>

Thanks.

-- 
Catalin

  reply	other threads:[~2009-12-02  9:55 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-02  7:55 [PATCH 0/2] fix for kmemleak_erase() (Re: Q, slab, kmemleak_erase() and redzone?) J. R. Okajima
2009-12-02  7:55 ` [PATCH 1/2] slab, kmemleak, minor, stop calling kmemleak_erase() unconditionally J. R. Okajima
2009-12-02  9:54   ` Catalin Marinas
2009-12-06  8:33     ` Pekka Enberg
2009-12-02  7:55 ` [PATCH 2/2] slab, kmemleak, bugfix, pass the correct pointer to kmemleak_erase() J. R. Okajima
2009-12-02  9:55   ` Catalin Marinas [this message]
2009-12-06  8:33     ` Pekka Enberg
2009-12-02  8:07 ` [PATCH 0/2] fix for kmemleak_erase() (Re: Q, slab, kmemleak_erase() and redzone?) Pekka Enberg

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=tnxmy214s5k.fsf@pc1117.cambridge.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=hooanon05@yahoo.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=penberg@cs.helsinki.fi \
    /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

all inboxes | Powered by JetHome®