Skip to content

Commit

Permalink
mm: nommu: check the vma list when unmapping file-mapped vma
Browse files Browse the repository at this point in the history
Now we have the sorted vma list, use it in do_munmap() to check that we
have an exact match.

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>
  • Loading branch information
Namhyung Kim authored and Linus Torvalds committed May 25, 2011
1 parent e922c4c commit d75a310
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions mm/nommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,6 @@ static int shrink_vma(struct mm_struct *mm,
int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
{
struct vm_area_struct *vma;
struct rb_node *rb;
unsigned long end = start + len;
int ret;

Expand Down Expand Up @@ -1668,9 +1667,8 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
}
if (end == vma->vm_end)
goto erase_whole_vma;
rb = rb_next(&vma->vm_rb);
vma = rb_entry(rb, struct vm_area_struct, vm_rb);
} while (rb);
vma = vma->vm_next;
} while (vma);
kleave(" = -EINVAL [split file]");
return -EINVAL;
} else {
Expand Down

0 comments on commit d75a310

Please sign in to comment.