From: Ken Chen Date: Tue, 24 Jul 2007 01:44:00 +0000 (-0700) Subject: fix hugetlb page allocation leak X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5ab3ee7b1cd5c91eb2272764f9d7d1fe4749681e;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git fix hugetlb page allocation leak dequeue_huge_page() has a serious memory leak upon hugetlb page allocation. The for loop continues on allocating hugetlb pages out of all allowable zone, where this function is supposedly only dequeue one and only one pages. Fixed it by breaking out of the for loop once a hugetlb page is found. Signed-off-by: Ken Chen Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index f127940ec24..d7ca59d66c5 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -84,6 +84,7 @@ static struct page *dequeue_huge_page(struct vm_area_struct *vma, list_del(&page->lru); free_huge_pages--; free_huge_pages_node[nid]--; + break; } } return page;