linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] mm: WARN_ON_ONCE if f_op->mmap() change vma's start address
@ 2012-11-14 17:28 Joonsoo Kim
  0 siblings, 0 replies; only message in thread
From: Joonsoo Kim @ 2012-11-14 17:28 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, linux-mm, Joonsoo Kim

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>

diff --git a/mm/mmap.c b/mm/mmap.c
index 2d94235..36567b7 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1333,7 +1333,11 @@ munmap_back:
 		 *
 		 * Answer: Yes, several device drivers can do it in their
 		 *         f_op->mmap method. -DaveM
+		 * Bug: If addr is changed, prev, rb_link, rb_parent should
+		 *      be updated for vma_link()
 		 */
+		WARN_ON_ONCE(addr != vma->vm_start);
+
 		addr = vma->vm_start;
 		pgoff = vma->vm_pgoff;
 		vm_flags = vma->vm_flags;
-- 
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-14 17:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 17:28 [RFC PATCH] mm: WARN_ON_ONCE if f_op->mmap() change vma's start address Joonsoo Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox