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)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 23 Sep 2010 00:22:40 +0000 (17:22 -0700)
commit2aeadc30de45a72648f271603203ab392b80f607
treef3368916a4b1efdfa205ae0891733995a456957f
parenta247c3a97a0216b18a46243eda26081f1928ec37
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 <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>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c