mm anon rmap: in mremap, set the new vma's position before anon_vma_clone()
authorMichel Lespinasse <walken@google.com>
Mon, 8 Oct 2012 23:31:48 +0000 (16:31 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Oct 2012 07:22:42 +0000 (16:22 +0900)
commit523d4e2008fd4a68b1a164e63e8c75b7b20f07e0
treec51d7fe7c6c614cf4cf8ef09f923a502cc18d279
parented8ea8150182f8d715fceb3b175ef0a9ebacd872
mm anon rmap: in mremap, set the new vma's position before anon_vma_clone()

anon_vma_clone() expects new_vma->vm_{start,end,pgoff} to be correctly set
so that the new vma can be indexed on the anon interval tree.

copy_vma() was failing to do that, which broke mremap().

Signed-off-by: Michel Lespinasse <walken@google.com>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: Hugh Dickins <hughd@google.com>
Tested-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/mmap.c