summaryrefslogtreecommitdiff
path: root/mm/mremap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-11-24 08:45:24 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-11 06:30:23 -0500
commit935874141df839c706cd6cdc438e85eb69d1525e (patch)
treeb55c66ff76e35332f8565bf20efd076d9dccf0cb /mm/mremap.c
parent097eed103862f9c6a97f2e415e21d1134017b135 (diff)
downloadlwn-935874141df839c706cd6cdc438e85eb69d1525e.tar.gz
lwn-935874141df839c706cd6cdc438e85eb69d1525e.zip
fix pgoff in "have to relocate" case of mremap()
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mremap.c')
-rw-r--r--mm/mremap.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/mremap.c b/mm/mremap.c
index 84efffb2d2c4..bbbbbf507ff3 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -495,7 +495,9 @@ unsigned long do_mremap(unsigned long addr,
map_flags |= MAP_SHARED;
new_addr = get_unmapped_area(vma->vm_file, 0, new_len,
- vma->vm_pgoff, map_flags);
+ vma->vm_pgoff +
+ ((addr - vma->vm_start) >> PAGE_SHIFT),
+ map_flags);
if (new_addr & ~PAGE_MASK) {
ret = new_addr;
goto out;