]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/3.1.5/hugetlb-release-pages-in-the-error-path-of-hugetlb_cow.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 3.1.5 / hugetlb-release-pages-in-the-error-path-of-hugetlb_cow.patch
CommitLineData
b468d7f8
GKH
1From ea4039a34c4c206d015d34a49d0b00868e37db1d Mon Sep 17 00:00:00 2001
2From: Hillf Danton <dhillf@gmail.com>
3Date: Tue, 15 Nov 2011 14:36:12 -0800
4Subject: hugetlb: release pages in the error path of hugetlb_cow()
5
6From: Hillf Danton <dhillf@gmail.com>
7
8commit ea4039a34c4c206d015d34a49d0b00868e37db1d upstream.
9
10If we fail to prepare an anon_vma, the {new, old}_page should be released,
11or they will leak.
12
13Signed-off-by: Hillf Danton <dhillf@gmail.com>
14Reviewed-by: Andrea Arcangeli <aarcange@redhat.com>
15Cc: Hugh Dickins <hughd@google.com>
16Cc: Johannes Weiner <jweiner@redhat.com>
17Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
18Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
19Cc: Michal Hocko <mhocko@suse.cz>
20Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
21
22---
23 mm/hugetlb.c | 2 ++
24 1 file changed, 2 insertions(+)
25
26--- a/mm/hugetlb.c
27+++ b/mm/hugetlb.c
28@@ -2422,6 +2422,8 @@ retry_avoidcopy:
29 * anon_vma prepared.
30 */
31 if (unlikely(anon_vma_prepare(vma))) {
32+ page_cache_release(new_page);
33+ page_cache_release(old_page);
34 /* Caller expects lock to be held */
35 spin_lock(&mm->page_table_lock);
36 return VM_FAULT_OOM;