Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea4039a3 authored by Hillf Danton's avatar Hillf Danton Committed by Linus Torvalds
Browse files

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: default avatarHillf Danton <dhillf@gmail.com>
Reviewed-by: default avatarAndrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 66e13e66
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;