Skip to content

Commit 0208fab

Browse files
Michal Hockogregkh
authored andcommitted
mm, hwpoison: fixup "mm: check the return value of lookup_page_ext for all call sites"
Backport of the upstream commit f86e4271978b ("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>
1 parent 5baf0fb commit 0208fab

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

mm/debug-pagealloc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static inline void set_page_poison(struct page *page)
3434
struct page_ext *page_ext;
3535

3636
page_ext = lookup_page_ext(page);
37-
if (page_ext)
37+
if (!page_ext)
3838
return;
3939
__set_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
4040
}
@@ -44,7 +44,7 @@ static inline void clear_page_poison(struct page *page)
4444
struct page_ext *page_ext;
4545

4646
page_ext = lookup_page_ext(page);
47-
if (page_ext)
47+
if (!page_ext)
4848
return;
4949
__clear_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
5050
}
@@ -54,7 +54,7 @@ static inline bool page_poison(struct page *page)
5454
struct page_ext *page_ext;
5555

5656
page_ext = lookup_page_ext(page);
57-
if (page_ext)
57+
if (!page_ext)
5858
return false;
5959
return test_bit(PAGE_EXT_DEBUG_POISON, &page_ext->flags);
6060
}

0 commit comments

Comments
 (0)