mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-02 09:16:41 +09:00
hugetlb: release pages in the error path of hugetlb_cow()
commit ea4039a34c upstream.
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>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
6d10c223ab
commit
d3b2937da9
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user