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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]