Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1645661 > unrolled thread

[PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print

Started byFiro Yang <firogm@gmail.com>
First post2017-05-19 16:50 +0200
Last post2017-05-19 16:50 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print Firo Yang <firogm@gmail.com> - 2017-05-19 16:50 +0200

#1645661 — [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print

FromFiro Yang <firogm@gmail.com>
Date2017-05-19 16:50 +0200
Subject[PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
Message-ID<tIRo5-3Bo-9@gated-at.bofh.it>
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

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web