summaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-04-20 16:20:01 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2012-04-20 17:29:13 -0700
commita46ef99d80817a167477ed1c8b4d90ee0c2e726f (patch)
tree3d8c980c627e8b9c009dbf63628a9be8b8d1069f /mm/mmap.c
parente4eb1ff61b323d6141614e5458a1f53c7046ff8e (diff)
downloadlinux-stable-a46ef99d80817a167477ed1c8b4d90ee0c2e726f.tar.gz
linux-stable-a46ef99d80817a167477ed1c8b4d90ee0c2e726f.tar.bz2
linux-stable-a46ef99d80817a167477ed1c8b4d90ee0c2e726f.zip
VM: add "vm_munmap()" helper function
Like the vm_brk() function, this is the same as "do_munmap()", except it does the VM locking for the caller. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index df51891c8646..4af45f519f19 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2107,21 +2107,24 @@ int do_munmap(struct mm_struct *mm, unsigned long start, size_t len)
return 0;
}
-
EXPORT_SYMBOL(do_munmap);
-SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
+int vm_munmap(struct mm_struct *mm, unsigned long start, size_t len)
{
int ret;
- struct mm_struct *mm = current->mm;
-
- profile_munmap(addr);
down_write(&mm->mmap_sem);
- ret = do_munmap(mm, addr, len);
+ ret = do_munmap(mm, start, len);
up_write(&mm->mmap_sem);
return ret;
}
+EXPORT_SYMBOL(vm_munmap);
+
+SYSCALL_DEFINE2(munmap, unsigned long, addr, size_t, len)
+{
+ profile_munmap(addr);
+ return vm_munmap(current->mm, addr, len);
+}
static inline void verify_mm_writelocked(struct mm_struct *mm)
{