Commit 5c5fbdbe authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] document unchecked do_munmaps in ipc/shm.c

From: Manfred Spraul <manfred@colorfullife.com>

There are a few unchecked do_munmap()s in the shm code.  Manfred's comment
explains why they are OK.
parent 055a54db
...@@ -759,6 +759,21 @@ asmlinkage long sys_shmdt(char __user *shmaddr) ...@@ -759,6 +759,21 @@ asmlinkage long sys_shmdt(char __user *shmaddr)
down_write(&mm->mmap_sem); down_write(&mm->mmap_sem);
/*
* This function tries to be smart and unmap shm segments that
* were modified by partial mlock or munmap calls:
* - It first determines the size of the shm segment that should be
* unmapped: It searches for a vma that is backed by shm and that
* started at address shmaddr. It records it's size and then unmaps
* it.
* - Then it unmaps all shm vmas that started at shmaddr and that
* are within the initially determined size.
* Errors from do_munmap are ignored: the function only fails if
* it's called with invalid parameters or if it's called to unmap
* a part of a vma. Both calls in this function are for full vmas,
* the parameters are directly copied from the vma itself and always
* valid - therefore do_munmap cannot fail. (famous last words?)
*/
/* /*
* If it had been mremap()'d, the starting address would not * If it had been mremap()'d, the starting address would not
* match the usual checks anyway. So assume all vma's are * match the usual checks anyway. So assume all vma's are
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment