From: Hillf Danton Date: Tue, 15 Nov 2011 22:36:12 +0000 (-0800) Subject: hugetlb: release pages in the error path of hugetlb_cow() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=ea4039a34c4c206d015d34a49d0b00868e37db1d;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git hugetlb: release pages in the error path of hugetlb_cow() If we fail to prepare an anon_vma, the {new, old}_page should be released, or they will leak. Signed-off-by: Hillf Danton Reviewed-by: Andrea Arcangeli Cc: Hugh Dickins Cc: Johannes Weiner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/hugetlb.c b/mm/hugetlb.c index dae27ba3be2c..bb28a5f9db8d 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2422,6 +2422,8 @@ retry_avoidcopy: * anon_vma prepared. */ if (unlikely(anon_vma_prepare(vma))) { + page_cache_release(new_page); + page_cache_release(old_page); /* Caller expects lock to be held */ spin_lock(&mm->page_table_lock); return VM_FAULT_OOM;