[PATCH] hugetlb: release pages in the error path of hugetlb_cow()

From: Hillf Danton
Date: Fri Nov 11 2011 - 08:01:21 EST


If fail to prepare anon_vma, {new, old}_page should be released, or they will
escape the track and/or control of memory management.

Thanks

Signed-off-by: Hillf Danton <dhillf@xxxxxxxxx>
---

--- a/mm/hugetlb.c Fri Nov 11 20:36:32 2011
+++ b/mm/hugetlb.c Fri Nov 11 20:43:06 2011
@@ -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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/