Skip to content

Commit

Permalink
mm, hwpoison: fixup "mm: check the return value of lookup_page_ext fo…
Browse files Browse the repository at this point in the history
…r all call sites"

Backport of the upstream commit f86e427 ("mm: check the return
value of lookup_page_ext for all call sites") is wrong for hwpoison
pages. I have accidentally negated the condition for bailout. This
basically disables hwpoison pages tracking while the code still
might crash on unusual configurations when struct pages do not have
page_ext allocated. The fix is trivial to invert the condition.

Reported-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Michal Hocko authored and Greg Kroah-Hartman committed Nov 24, 2017
1 parent 5baf0fb commit 0208fab
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/debug-pagealloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ static inline void set_page_poison(struct page *page)
struct page_ext *page_ext;

page_ext = lookup_page_ext(page);
if (page_ext)
if (!page_ext)
return;
__set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
}
Expand All @@ -44,7 +44,7 @@ static inline void clear_page_poison(struct page *page)
struct page_ext *page_ext;

page_ext = lookup_page_ext(page);
if (page_ext)
if (!page_ext)
return;
__clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
}
Expand All @@ -54,7 +54,7 @@ static inline bool page_poison(struct page *page)
struct page_ext *page_ext;

page_ext = lookup_page_ext(page);
if (page_ext)
if (!page_ext)
return false;
return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
}
Expand Down

0 comments on commit 0208fab

Please sign in to comment.