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


Groups > linux.kernel > #1645658

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

From Michal Hocko <mhocko@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm, vmstat: Fix NULL pointer dereference during pagetypeinfo print
Date 2017-05-19 16:50 +0200
Message-ID <tIRo5-3Bo-7@gated-at.bofh.it> (permalink)
References <tIRo5-3Bo-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

Re: [PATCH] mm, vmstat: Fix NULL pointer dereference during  pagetypeinfo print Michal Hocko <mhocko@kernel.org> - 2017-05-19 16:50 +0200

csiph-web