From: Michal Hocko <mhocko@kernel.org>
To: Firo Yang <firogm@gmail.com>
Cc: akpm@linux-foundation.org, vbabka@suse.cz,
mgorman@techsingularity.net, hannes@cmpxchg.org,
bigeasy@linutronix.de, iamjoonsoo.kim@lge.com,
rientjes@google.com, hughd@google.com, cl@linux.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
Date: Fri, 19 May 2017 16:48:56 +0200 [thread overview]
Message-ID: <20170519144856.GK29839@dhcp22.suse.cz> (raw)
In-Reply-To: <20170519143936.21209-1-firogm@gmail.com>
On Fri 19-05-17 22:39:36, Firo Yang wrote:
> During showing the pagetypeinfo, we forgot to save the found page
> and dereference a invalid page address from the stack.
>
> To fix it, save and reference the page address returned by
> pfn_to_online_page().
Thanks for taking catching that and your fix. I have already posted a fix
http://lkml.kernel.org/r/20170519072225.GA13041@dhcp22.suse.cz earlier
today. Sorry about troubles
> Signed-off-by: Firo Yang <firogm@gmail.com>
> ---
> mm/vmstat.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/mm/vmstat.c b/mm/vmstat.c
> index c432e58..6dae6b2 100644
> --- a/mm/vmstat.c
> +++ b/mm/vmstat.c
> @@ -1223,7 +1223,8 @@ static void pagetypeinfo_showblockcount_print(struct seq_file *m,
> for (pfn = start_pfn; pfn < end_pfn; pfn += pageblock_nr_pages) {
> struct page *page;
>
> - if (!pfn_to_online_page(pfn))
> + page = pfn_to_online_page(pfn);
> + if (!page)
> continue;
>
> /* Watch for unexpected holes punched in the memmap */
> --
> 2.9.4
>
--
Michal Hocko
SUSE Labs
--
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>
prev parent reply other threads:[~2017-05-19 14:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 14:39 Firo Yang
2017-05-19 14:48 ` Michal Hocko [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=20170519144856.GK29839@dhcp22.suse.cz \
--to=mhocko@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cl@linux.com \
--cc=firogm@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=hughd@google.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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