提交 ea4039a3 编写于 作者: H Hillf Danton 提交者: Linus Torvalds

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: NHillf Danton <dhillf@gmail.com>
Reviewed-by: NAndrea Arcangeli <aarcange@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <jweiner@redhat.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 66e13e66
......@@ -2422,6 +2422,8 @@ static int hugetlb_cow(struct mm_struct *mm, struct vm_area_struct *vma,
* 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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册