summaryrefslogtreecommitdiffstats
path: root/drivers/video/udlfb.c
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-18 08:39:47 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2013-04-26 08:28:56 +0300
commit04f8afbec37f63fafce16e454a7848426aa36202 (patch)
tree1c761c03f67ebdc71163aaaf0389a092f29916c6 /drivers/video/udlfb.c
parent11bd5933abe033fb7a3a0d1f1bd2cb4b6df8143f (diff)
downloadlinux-04f8afbec37f63fafce16e454a7848426aa36202.tar.bz2
fbdev: improve fb_mmap bounds checks
Improve fb_mmap bounds checks in gbefb, smscufx, udlfb and vfb drivers to prevent possible uint overflows. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Steve Glendinning <steve.glendinning@smsc.com> Cc: Bernie Thompson <bernie@plugable.com>
Diffstat (limited to 'drivers/video/udlfb.c')
-rw-r--r--drivers/video/udlfb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/video/udlfb.c b/drivers/video/udlfb.c
index 86d449ea3169..ec03e726c940 100644
--- a/drivers/video/udlfb.c
+++ b/drivers/video/udlfb.c
@@ -324,7 +324,11 @@ static int dlfb_ops_mmap(struct fb_info *info, struct vm_area_struct *vma)
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
unsigned long page, pos;
- if (offset + size > info->fix.smem_len)
+ if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT))
+ return -EINVAL;
+ if (size > info->fix.smem_len)
+ return -EINVAL;
+ if (offset > info->fix.smem_len - size)
return -EINVAL;
pos = (unsigned long)info->fix.smem_start + offset;