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


Groups > linux.kernel > #1550704 > unrolled thread

Re: [PATCH 1/2] mm: don't dereference struct page fields of invalid pages

Started byWill Deacon <will.deacon@arm.com>
First post2017-01-04 13:20 +0100
Last post2017-01-04 13:20 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] mm: don't dereference struct page fields of invalid  pages Will Deacon <will.deacon@arm.com> - 2017-01-04 13:20 +0100

#1550704 — Re: [PATCH 1/2] mm: don't dereference struct page fields of invalid pages

FromWill Deacon <will.deacon@arm.com>
Date2017-01-04 13:20 +0100
SubjectRe: [PATCH 1/2] mm: don't dereference struct page fields of invalid pages
Message-ID<sVSHT-4z2-3@gated-at.bofh.it>
On Wed, Dec 14, 2016 at 09:11:46AM +0000, Ard Biesheuvel wrote:
> The VM_BUG_ON() check in move_freepages() checks whether the node
> id of a page matches the node id of its zone. However, it does this
> before having checked whether the struct page pointer refers to a
> valid struct page to begin with. This is guaranteed in most cases,
> but may not be the case if CONFIG_HOLES_IN_ZONE=y.
> 
> So reorder the VM_BUG_ON() with the pfn_valid_within() check.
> 
> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
>  mm/page_alloc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index f64e7bcb43b7..4e298e31fa86 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -1864,14 +1864,14 @@ int move_freepages(struct zone *zone,
>  #endif
>  
>  	for (page = start_page; page <= end_page;) {
> -		/* Make sure we are not inadvertently changing nodes */
> -		VM_BUG_ON_PAGE(page_to_nid(page) != zone_to_nid(zone), page);
> -
>  		if (!pfn_valid_within(page_to_pfn(page))) {
>  			page++;
>  			continue;
>  		}
>  
> +		/* Make sure we are not inadvertently changing nodes */
> +		VM_BUG_ON_PAGE(page_to_nid(page) != zone_to_nid(zone), page);
> +
>  		if (!PageBuddy(page)) {
>  			page++;
>  			continue;

Acked-by: Will Deacon <will.deacon@arm.com>

I'm guessing akpm can pick this up as a non-urgent fix.

Will

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web