aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorJoonsoo Kim <js1304@gmail.com>2012-12-12 16:51:53 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-12 20:38:33 -0500
commit2897b4d29d9fca82a57b09b8a216a5d604966e4b (patch)
tree0b6efa9f80c4115949cc3d26eaddfd3e7031bbae /mm/mmap.c
parent44e33e8f95171b93968c3ac3cf8516998b1db65d (diff)
mm: WARN_ON_ONCE if f_op->mmap() change vma's start address
During reviewing the source code, I found a comment which mention that after f_op->mmap(), vma's start address can be changed. I didn't verify that it is really possible, because there are so many f_op->mmap() implementation. But if there are some mmap() which change vma's start address, it is possible error situation, because we already prepare prev vma, rb_link and rb_parent and these are related to original address. So add WARN_ON_ONCE for finding that this situtation really happens. Signed-off-by: Joonsoo Kim <js1304@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index f940062c8d4b..9ed3a06242a0 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1488,7 +1488,11 @@ munmap_back:
1488 * 1488 *
1489 * Answer: Yes, several device drivers can do it in their 1489 * Answer: Yes, several device drivers can do it in their
1490 * f_op->mmap method. -DaveM 1490 * f_op->mmap method. -DaveM
1491 * Bug: If addr is changed, prev, rb_link, rb_parent should
1492 * be updated for vma_link()
1491 */ 1493 */
1494 WARN_ON_ONCE(addr != vma->vm_start);
1495
1492 addr = vma->vm_start; 1496 addr = vma->vm_start;
1493 pgoff = vma->vm_pgoff; 1497 pgoff = vma->vm_pgoff;
1494 vm_flags = vma->vm_flags; 1498 vm_flags = vma->vm_flags;