From: Firo Yang <firogm@gmail.com>
To: akpm@linux-foundation.org
Cc: vbabka@suse.cz, mgorman@techsingularity.net, hannes@cmpxchg.org,
mhocko@suse.com, 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,
Firo Yang <firogm@gmail.com>
Subject: [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
Date: Fri, 19 May 2017 22:39:36 +0800 [thread overview]
Message-ID: <20170519143936.21209-1-firogm@gmail.com> (raw)
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().
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
--
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>
next reply other threads:[~2017-05-19 14:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 14:39 Firo Yang [this message]
2017-05-19 14:48 ` Michal Hocko
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=20170519143936.21209-1-firogm@gmail.com \
--to=firogm@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=cl@linux.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=mhocko@suse.com \
--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