* [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
@ 2017-05-19 14:39 Firo Yang
2017-05-19 14:48 ` Michal Hocko
0 siblings, 1 reply; 2+ messages in thread
From: Firo Yang @ 2017-05-19 14:39 UTC (permalink / raw)
To: akpm
Cc: vbabka, mgorman, hannes, mhocko, bigeasy, iamjoonsoo.kim,
rientjes, hughd, cl, linux-mm, linux-kernel, Firo Yang
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
2017-05-19 14:39 [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print Firo Yang
@ 2017-05-19 14:48 ` Michal Hocko
0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2017-05-19 14:48 UTC (permalink / raw)
To: Firo Yang
Cc: akpm, vbabka, mgorman, hannes, bigeasy, iamjoonsoo.kim, rientjes,
hughd, cl, linux-mm, linux-kernel
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>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-05-19 14:49 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-19 14:39 [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print Firo Yang
2017-05-19 14:48 ` Michal Hocko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox