linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] unlink_anon_vmas in __split_vma in case of error
@ 2010-09-15 17:18 Andrea Arcangeli
  2010-09-15 19:51 ` Hugh Dickins
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Andrea Arcangeli @ 2010-09-15 17:18 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, Johannes Weiner, Rik van Riel, Hugh Dickins,
	Marcelo Tosatti

From: Andrea Arcangeli <aarcange@redhat.com>

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>
---

diff --git a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2014,6 +2014,7 @@ static int __split_vma(struct mm_struct 
 			removed_exe_file_vma(mm);
 		fput(new->vm_file);
 	}
+	unlink_anon_vmas(new);
  out_free_mpol:
 	mpol_put(pol);
  out_free_vma:

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-09-15 20:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-15 17:18 [PATCH] unlink_anon_vmas in __split_vma in case of error Andrea Arcangeli
2010-09-15 19:51 ` Hugh Dickins
2010-09-15 20:07 ` Johannes Weiner
2010-09-15 20:38 ` Rik van Riel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).