summaryrefslogtreecommitdiff
path: root/drivers/uio
diff options
context:
space:
mode:
authorBin Wang <binw@marvell.com>2014-03-25 09:52:06 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-05-28 01:11:06 +0400
commitddb09754e6c7239e302c7b675df9bbd415f8de5d (patch)
treeb8bb721fe4a516240583e740c33d751df2eb28c6 /drivers/uio
parentca3c61f358d8e5a4b2732d6aa81ac46f677e69f0 (diff)
downloadlinux-ddb09754e6c7239e302c7b675df9bbd415f8de5d.tar.xz
uio: fix vma io range check in mmap
the vma range size is always page size aligned in mmap, while the real io space range may not be page aligned, thus leading to range check failure in the uio_mmap_physical(). for example, in a case of io range size "mem->size == 1KB", and we have (vma->vm_end - vma->vm_start) == 4KB, due to "len" is aligned to page size in do_mmap_pgoff(). now fix this issue by align mem->size to page size in the check. Signed-off-by: Bin Wang <binw@marvell.com> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/uio')
-rw-r--r--drivers/uio/uio.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index a673e5b6a2e0..e371f5af11f5 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -655,7 +655,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
if (mem->addr & ~PAGE_MASK)
return -ENODEV;
- if (vma->vm_end - vma->vm_start > mem->size)
+ if (vma->vm_end - vma->vm_start > PAGE_ALIGN(mem->size))
return -EINVAL;
vma->vm_ops = &uio_physical_vm_ops;