aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Liu <lliubbo@gmail.com>2011-07-08 15:39:46 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2011-08-03 12:42:23 -0700
commitf8936c0405f71df612e6e4cb19dbed35caa79680 (patch)
tree77474d653e9e2e6330080be1a9b419a96d28d3b8
parent0cd2efd36623c7888a9ae10a7e834cc20f6b300a (diff)
mm/nommu.c: fix remap_pfn_range()
commit 8f3b1327aa454bc8283e96bca7669c3c88b83f79 upstream. remap_pfn_range() means map physical address pfn<<PAGE_SHIFT to user addr. For nommu arch it's implemented by vma->vm_start = pfn << PAGE_SHIFT which is wrong acroding the original meaning of this function. And some driver developer using remap_pfn_range() with correct parameter will get unexpected result because vm_start is changed. It should be implementd like addr = pfn << PAGE_SHIFT but which is meanless on nommu arch, this patch just make it simply return. Parameter name and setting of vma->vm_flags also be fixed. Signed-off-by: Bob Liu <lliubbo@gmail.com> Cc: Geert Uytterhoeven <geert@linux-m68k.org> Cc: David Howells <dhowells@redhat.com> Acked-by: Greg Ungerer <gerg@uclinux.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Bob Liu <lliubbo@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--mm/nommu.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/mm/nommu.c b/mm/nommu.c
index c4c542c736a..0376a4c3387 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1819,10 +1819,13 @@ struct page *follow_page(struct vm_area_struct *vma, unsigned long address,
return NULL;
}
-int remap_pfn_range(struct vm_area_struct *vma, unsigned long from,
- unsigned long to, unsigned long size, pgprot_t prot)
+int remap_pfn_range(struct vm_area_struct *vma, unsigned long addr,
+ unsigned long pfn, unsigned long size, pgprot_t prot)
{
- vma->vm_start = vma->vm_pgoff << PAGE_SHIFT;
+ if (addr != (pfn << PAGE_SHIFT))
+ return -EINVAL;
+
+ vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
return 0;
}
EXPORT_SYMBOL(remap_pfn_range);