All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Hutchings <ben.hutchings@codethink.co.uk>
To: Michal Hocko <mhocko@kernel.org>, Greg KH <gregkh@linuxfoundation.org>
Cc: jaewon31.kim@samsung.com, akpm@linux-foundation.org,
	js1304@gmail.com, mhocko@suse.com, minchan@kernel.org,
	stable@vger.kernel.org, torvalds@linux-foundation.org,
	Yang Shi <yang.shi@linaro.org>, Arnd Bergmann <arnd@arndb.de>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>
Subject: Re: [PATCH stable-4.4 1/2] mm: check the return value of lookup_page_ext for all call sites
Date: Tue, 05 Dec 2017 16:16:35 +0000	[thread overview]
Message-ID: <1512490595.18523.175.camel@codethink.co.uk> (raw)
In-Reply-To: <20171122120937.14241-1-mhocko@kernel.org>

On Wed, 2017-11-22 at 13:09 +0100, Michal Hocko wrote:
> From: Yang Shi <yang.shi@linaro.org>
> 
> commit f86e4271978bd93db466d6a95dad4b0fdcdb04f6 upstream.
> 
> Per the discussion with Joonsoo Kim [1], we need check the return value
> of lookup_page_ext() for all call sites since it might return NULL in
> some cases, although it is unlikely, i.e.  memory hotplug.
> 
> Tested with ltp with "page_owner=0".
[...]
> --- a/mm/debug-pagealloc.c
> +++ b/mm/debug-pagealloc.c
> @@ -34,6 +34,8 @@ static inline void set_page_poison(struct page
> *page)
>  	struct page_ext *page_ext;
>  
>  	page_ext = lookup_page_ext(page);
> +	if (page_ext)
> +		return;

This, and the other checks added to debug-pagealloc.c, are reversed. 
(This is specific to the 4.4 backport - in the upstream version these
functions are in mm/page_poison.c and were patched correctly.)

Ben.

>  	__set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
>  }
>  
> @@ -42,6 +44,8 @@ static inline void clear_page_poison(struct page
> *page)
>  	struct page_ext *page_ext;
>  
>  	page_ext = lookup_page_ext(page);
> +	if (page_ext)
> +		return;
>  	__clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
>  }
>  
> @@ -50,6 +54,8 @@ static inline bool page_poison(struct page *page)
>  	struct page_ext *page_ext;
>  
>  	page_ext = lookup_page_ext(page);
> +	if (page_ext)
> +		return false;
>  	return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
>  }
>  
[...]

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

  parent reply	other threads:[~2017-12-05 16:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-22  8:37 FAILED: patch "[PATCH] mm/page_ext.c: check if page_ext is not prepared" failed to apply to 4.4-stable tree gregkh
2017-11-22  9:47 ` Michal Hocko
2017-11-22  9:54   ` Greg KH
2017-11-22 12:08     ` Michal Hocko
2017-11-22 12:09 ` [PATCH stable-4.4 1/2] mm: check the return value of lookup_page_ext for all call sites Michal Hocko
2017-11-22 12:09   ` [PATCH stable-4.4 2/2] mm/page_ext.c: check if page_ext is not prepared Michal Hocko
2017-11-22 14:04   ` [PATCH stable-4.4 1/2] mm: check the return value of lookup_page_ext for all call sites Greg KH
2017-11-24  9:17   ` Jiri Slaby
2017-11-24  9:28     ` Michal Hocko
2017-11-24  9:29       ` Jiri Slaby
2017-11-24  9:39         ` Michal Hocko
2017-11-24 10:14           ` Greg KH
2017-11-24  9:30       ` [PATCH] " Michal Hocko
2017-11-24  9:39         ` Greg KH
2017-12-05 16:16   ` Ben Hutchings [this message]
2017-12-05 16:17     ` [PATCH stable-4.4 1/2] " Ben Hutchings
2017-12-05 19:16     ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1512490595.18523.175.camel@codethink.co.uk \
    --to=ben.hutchings@codethink.co.uk \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jaewon31.kim@samsung.com \
    --cc=js1304@gmail.com \
    --cc=mhocko@kernel.org \
    --cc=mhocko@suse.com \
    --cc=minchan@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yang.shi@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.