From 7223bb4a829628bdf37d544ed4363d99bac1ade6 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Tue, 24 May 2011 17:11:26 -0700 Subject: [PATCH] mm: nommu: fix a potential memory leak in do_mmap_private() If f_op->read() fails and sysctl_nr_trim_pages > 1, there could be a memory leak between @region->vm_end and @region->vm_top. Signed-off-by: Namhyung Kim Acked-by: Greg Ungerer Cc: David Howells Cc: Paul Mundt Cc: Geert Uytterhoeven Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/nommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/nommu.c b/mm/nommu.c index 0563fd9003d..57ae6126b29 100644 --- a/mm/nommu.c +++ b/mm/nommu.c @@ -1217,7 +1217,7 @@ static int do_mmap_private(struct vm_area_struct *vma, return 0; error_free: - free_page_series(region->vm_start, region->vm_end); + free_page_series(region->vm_start, region->vm_top); region->vm_start = vma->vm_start = 0; region->vm_end = vma->vm_end = 0; region->vm_top = 0; -- 2.20.1