Skip to content

Commit 6c54312

Browse files
sidkumar99akpm00
authored andcommitted
mm/memory-failure: fix hardware poison check in unpoison_memory()
It was pointed out[1] that using folio_test_hwpoison() is wrong as we need to check the indiviual page that has poison. folio_test_hwpoison() only checks the head page so go back to using PageHWPoison(). User-visible effects include existing hwpoison-inject tests possibly failing as unpoisoning a single subpage could lead to unpoisoning an entire folio. Memory unpoisoning could also not work as expected as the function will break early due to only checking the head page and not the actually poisoned subpage. [1]: https://lore.kernel.org/lkml/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Fixes: a6fddef ("mm/memory-failure: convert unpoison_memory() to folios") Signed-off-by: Sidhartha Kumar <[email protected]> Reported-by: Matthew Wilcox (Oracle) <[email protected]> Acked-by: Naoya Horiguchi <[email protected]> Reviewed-by: Miaohe Lin <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 641db40 commit 6c54312

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memory-failure.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2487,7 +2487,7 @@ int unpoison_memory(unsigned long pfn)
24872487
goto unlock_mutex;
24882488
}
24892489

2490-
if (!folio_test_hwpoison(folio)) {
2490+
if (!PageHWPoison(p)) {
24912491
unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n",
24922492
pfn, &unpoison_rs);
24932493
goto unlock_mutex;

0 commit comments

Comments
 (0)