]> git.baikalelectronics.ru Git - kernel.git/commit
hugetlb: fix memoryleak in hugetlb_mcopy_atomic_pte
authorMiaohe Lin <linmiaohe@huawei.com>
Sat, 9 Jul 2022 09:26:29 +0000 (17:26 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Aug 2022 10:03:42 +0000 (12:03 +0200)
commit67895641accfb3e2880edbb631fa7dc37a77a93b
treedc9967d766281a1e9b1b746b6b1d662f78f940a5
parent3bc390d80d210550ded7021c413d7ac302321817
hugetlb: fix memoryleak in hugetlb_mcopy_atomic_pte

commit b1ac792fc18916a4cfe8dc540e5b1f990ca54b4d upstream.

When alloc_huge_page fails, *pagep is set to NULL without put_page first.
So the hugepage indicated by *pagep is leaked.

Link: https://lkml.kernel.org/r/20220709092629.54291-1-linmiaohe@huawei.com
Fixes: f741324156c6 ("mm, hugetlb: fix racy resv_huge_pages underflow on UFFDIO_COPY")
Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
Acked-by: Muchun Song <songmuchun@bytedance.com>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Reviewed-by: Mike Kravetz <mike.kravetz@oracle.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/hugetlb.c