aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHillf Danton <[email protected]>2011-11-15 14:36:12 -0800
committerLinus Torvalds <[email protected]>2011-11-15 22:41:52 -0200
commitea4039a34c4c206d015d34a49d0b00868e37db1d (patch)
tree1c7c38a83e0765f717f11079c573bb94f7445b77
parent66e13e66b6c4e5b2ecd6225e1f8437640cfb6498 (diff)
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 <[email protected]> Reviewed-by: Andrea Arcangeli <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Johannes Weiner <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r--mm/hugetlb.c2
1 files changed, 2 insertions, 0 deletions
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;