Commit 92a025a7 authored by Miaohe Lin's avatar Miaohe Lin Committed by Andrew Morton

mm: memory-failure: ensure moving HWPoison flag to the raw error pages

If hugetlb_vmemmap_optimized is enabled, folio_clear_hugetlb_hwpoison()
called from try_memory_failure_hugetlb() won't transfer HWPoison flag to
subpages while folio's HWPoison flag is cleared.  So when trying to free
this hugetlb page into buddy, folio_clear_hugetlb_hwpoison() is not called
to move HWPoison flag from head page to the raw error pages even if now
hugetlb_vmemmap_optimized is cleared.  This will results in HWPoisoned
page being used again and raw_hwp_page leak.

Link: https://lkml.kernel.org/r/20230711055016.2286677-3-linmiaohe@huawei.com
Fixes: ac5fcde0 ("mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage")
Signed-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Acked-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent dbe70dbb
...@@ -1908,6 +1908,8 @@ void folio_clear_hugetlb_hwpoison(struct folio *folio) ...@@ -1908,6 +1908,8 @@ void folio_clear_hugetlb_hwpoison(struct folio *folio)
{ {
if (folio_test_hugetlb_raw_hwp_unreliable(folio)) if (folio_test_hugetlb_raw_hwp_unreliable(folio))
return; return;
if (folio_test_hugetlb_vmemmap_optimized(folio))
return;
folio_clear_hwpoison(folio); folio_clear_hwpoison(folio);
folio_free_raw_hwp(folio, true); folio_free_raw_hwp(folio, true);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment