]> Git Repo - linux.git/commitdiff
hugetlb: release pages in the error path of hugetlb_cow()
authorHillf Danton <[email protected]>
Tue, 15 Nov 2011 22:36:12 +0000 (14:36 -0800)
committerLinus Torvalds <[email protected]>
Wed, 16 Nov 2011 00:41:52 +0000 (22:41 -0200)
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]>
mm/hugetlb.c

index dae27ba3be2c8523cd032ad330e2f5a32fbffaf3..bb28a5f9db8ddbf2f65391fe9206ca99b46a256b 100644 (file)
@@ -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;
This page took 0.05574 seconds and 4 git commands to generate.