]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm, hwpoison: fix page refcnt leaking in unpoison_memory()
authorMiaohe Lin <linmiaohe@huawei.com>
Thu, 18 Aug 2022 13:00:12 +0000 (21:00 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 22 Aug 2022 22:58:15 +0000 (15:58 -0700)
When free_raw_hwp_pages() fails its work, the refcnt of the hugetlb page
would have been incremented if ret > 0.  Using put_page() to fix refcnt
leaking in this case.

Link: https://lkml.kernel.org/r/20220818130016.45313-3-linmiaohe@huawei.com
Fixes: debb6b9c3fdd ("mm, hwpoison: make unpoison aware of raw error info in hwpoisoned hugepage")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memory-failure.c

index 22840cd5fe5956f474dc53d63eb1e88f7947e0d4..0c5ad7505b998a1601a446ac6796a1eaaaa2dcfd 100644 (file)
@@ -2378,6 +2378,7 @@ int unpoison_memory(unsigned long pfn)
                        count = free_raw_hwp_pages(page, false);
                        if (count == 0) {
                                ret = -EBUSY;
+                               put_page(page);
                                goto unlock_mutex;
                        }
                }