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 <dhillf@gmail.com> Reviewed-by: Andrea Arcangeli <aarcange@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: Johannes Weiner <jweiner@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
66e13e66b6
commit
ea4039a34c
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue