lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170519143936.21209-1-firogm@gmail.com>
Date:   Fri, 19 May 2017 22:39:36 +0800
From:   Firo Yang <firogm@...il.com>
To:     akpm@...ux-foundation.org
Cc:     vbabka@...e.cz, mgorman@...hsingularity.net, hannes@...xchg.org,
        mhocko@...e.com, bigeasy@...utronix.de, iamjoonsoo.kim@....com,
        rientjes@...gle.com, hughd@...gle.com, cl@...ux.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Firo Yang <firogm@...il.com>
Subject: [PATCH] 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 <firogm@...il.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ