mm: memory-failure: fix potential page refcnt leak in memory_failure()
authorMiaohe Lin <linmiaohe@huawei.com>
Sat, 1 Jul 2023 07:28:37 +0000 (15:28 +0800)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 24 Aug 2023 23:20:16 +0000 (16:20 -0700)
commitd51b68469bc7804c34622f7f3d4889628d37cfd6
treecf23abb613ee3caa2990a647eac8e032390015f1
parent08dff2810e8feb3096bf5c8242ab1649d1e8b1a4
mm: memory-failure: fix potential page refcnt leak in memory_failure()

put_ref_page() is not called to drop extra refcnt when comes from madvise
in the case pfn is valid but pgmap is NULL leading to page refcnt leak.

Link: https://lkml.kernel.org/r/20230701072837.1994253-1-linmiaohe@huawei.com
Fixes: 1e8aaedb182d ("mm,memory_failure: always pin the page in madvise_inject_error")
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