summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSidhartha Kumar <sidhartha.kumar@oracle.com>2023-07-17 11:18:12 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-08-03 10:26:14 +0200
commitda84cd9b5e03464c177cabf9692853708626456f (patch)
tree71167d0f4c1df5753f4dcaaf6a8e69c676ec59b4
parentbdb3106af2b26e8f10dee7353f0ef63bf84fd6de (diff)
downloadlinux-stable-da84cd9b5e03464c177cabf9692853708626456f.tar.gz
linux-stable-da84cd9b5e03464c177cabf9692853708626456f.tar.bz2
linux-stable-da84cd9b5e03464c177cabf9692853708626456f.zip
mm/memory-failure: fix hardware poison check in unpoison_memory()
commit 6c54312f9689fbe27c70db5d42eebd29d04b672e upstream. 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/ZLIbZygG7LqSI9xe@casper.infradead.org/ Link: https://lkml.kernel.org/r/20230717181812.167757-1-sidhartha.kumar@oracle.com Fixes: a6fddef49eef ("mm/memory-failure: convert unpoison_memory() to folios") Signed-off-by: Sidhartha Kumar <sidhartha.kumar@oracle.com> Reported-by: Matthew Wilcox (Oracle) <willy@infradead.org> Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com> Reviewed-by: Miaohe Lin <linmiaohe@huawei.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--mm/memory-failure.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 5b663eca1f29..47e2b545ffcc 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -2490,7 +2490,7 @@ int unpoison_memory(unsigned long pfn)
goto unlock_mutex;
}
- if (!folio_test_hwpoison(folio)) {
+ if (!PageHWPoison(p)) {
unpoison_pr_info("Unpoison: Page was already unpoisoned %#lx\n",
pfn, &unpoison_rs);
goto unlock_mutex;