mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
Subsystems (2)
PATCH 1/1 mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
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 <[email protected]>
--- mm/vmstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
mm/vmstat.c +2 -1
@@ -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 */
Signature · 7 lines
2.9.4 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Quoted 5 lines · 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().
Thanks for taking catching that and your fix. I have already posted a fix
http://lkml.kernel.org/r/[email protected] earlier today. Sorry about troubles
Quoted 22 lines
Signed-off-by Firo Yang <[email protected]>--- mm/vmstat.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)mm/vmstat.c +2
-1@@ -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 */ Signature · 1 line
2.9.4
Signature · 8 lines
Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"[email protected]"> [email protected] </a>