From: Andrea Arcangeli Date: Wed, 22 Sep 2010 20:05:12 +0000 (-0700) Subject: mmap: call unlink_anon_vmas() in __split_vma() in case of error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2aeadc30de45a72648f271603203ab392b80f607;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git mmap: call unlink_anon_vmas() in __split_vma() in case of error If __split_vma fails because of an out of memory condition the anon_vma_chain isn't teardown and freed potentially leading to rmap walks accessing freed vma information plus there's a memleak. Signed-off-by: Andrea Arcangeli Acked-by: Johannes Weiner Acked-by: Rik van Riel Acked-by: Hugh Dickins Cc: Marcelo Tosatti Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/mmap.c b/mm/mmap.c index 6128dc8e5ede..00161a48a451 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2009,6 +2009,7 @@ static int __split_vma(struct mm_struct * mm, struct vm_area_struct * vma, removed_exe_file_vma(mm); fput(new->vm_file); } + unlink_anon_vmas(new); out_free_mpol: mpol_put(pol); out_free_vma: