diff options
author | Namhyung Kim <namhyung@gmail.com> | 2011-05-24 20:11:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-05-25 11:39:06 -0400 |
commit | 7223bb4a829628bdf37d544ed4363d99bac1ade6 (patch) | |
tree | 4c300b6753a2346d24503e3d3d8f4a699758d21f /mm | |
parent | d75a310c42c616c168953ed45c1091074f97828c (diff) |
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 <namhyung@gmail.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r-- | mm/nommu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/nommu.c b/mm/nommu.c index 0563fd9003df..57ae6126b29a 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1217,7 +1217,7 @@ static int do_mmap_private(struct vm_area_struct *vma, | |||
1217 | return 0; | 1217 | return 0; |
1218 | 1218 | ||
1219 | error_free: | 1219 | error_free: |
1220 | free_page_series(region->vm_start, region->vm_end); | 1220 | free_page_series(region->vm_start, region->vm_top); |
1221 | region->vm_start = vma->vm_start = 0; | 1221 | region->vm_start = vma->vm_start = 0; |
1222 | region->vm_end = vma->vm_end = 0; | 1222 | region->vm_end = vma->vm_end = 0; |
1223 | region->vm_top = 0; | 1223 | region->vm_top = 0; |