]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mmap: call unlink_anon_vmas() in __split_vma() in case of error
authorAndrea Arcangeli <aarcange@redhat.com>
Wed, 22 Sep 2010 20:05:12 +0000 (13:05 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 27 Sep 2010 00:18:25 +0000 (17:18 -0700)
commit 2aeadc30de45a72648f271603203ab392b80f607 upstream.

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 <aarcange@redhat.com>
Acked-by: Johannes Weiner <jweiner@redhat.com>
Acked-by: Rik van Riel <riel@redhat.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
mm/mmap.c

index 3867cfc21cc796b6e885b3b9531c64f1033f7f3d..12d38bf4f5b0f0960d55b77efc8e2be7b3360a72 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1997,6 +1997,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: