linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Catalin Marinas <catalin.marinas@arm.com>
To: Qian Cai <cai@lca.pw>
Cc: akpm@linux-foundation.org, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/page_ext: fix an imbalance with kmemleak
Date: Wed, 27 Feb 2019 17:21:13 +0000	[thread overview]
Message-ID: <20190227172113.GE125513@arrakis.emea.arm.com> (raw)
In-Reply-To: <20190227171556.75444-1-cai@lca.pw>

On Wed, Feb 27, 2019 at 12:15:56PM -0500, Qian Cai wrote:
> After offlined a memory block, kmemleak scan will trigger a crash, as it
> encounters a page ext address that has already been freed during memory
> offlining. At the beginning in alloc_page_ext(), it calls
> kmemleak_alloc(), but it does not call kmemleak_free() in
> __free_page_ext().
[...]
> diff --git a/mm/page_ext.c b/mm/page_ext.c
> index 8c78b8d45117..b68f2a58ea3b 100644
> --- a/mm/page_ext.c
> +++ b/mm/page_ext.c
> @@ -288,6 +288,7 @@ static void __free_page_ext(unsigned long pfn)
>  	base = get_entry(ms->page_ext, pfn);
>  	free_page_ext(base);
>  	ms->page_ext = NULL;
> +	kmemleak_free(base);
>  }

The kmemleak_free() call should be placed before free_page_ext() to
avoid a small window where the address has been freed but kmemleak not
informed.

-- 
Catalin


      reply	other threads:[~2019-02-27 17:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-27 17:15 [PATCH] mm/page_ext: fix an imbalance with kmemleak Qian Cai
2019-02-27 17:21 ` Catalin Marinas [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=20190227172113.GE125513@arrakis.emea.arm.com \
    --to=catalin.marinas@arm.com \
    --cc=akpm@linux-foundation.org \
    --cc=cai@lca.pw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /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;
as well as URLs for NNTP newsgroup(s).