]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
media: rc: check for integer overflow
authorSean Young <sean@mess.org>
Sun, 8 Oct 2017 18:18:52 +0000 (14:18 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Wed, 11 Oct 2017 16:41:52 +0000 (12:41 -0400)
The ioctl LIRC_SET_REC_TIMEOUT would set a timeout of 704ns if called
with a timeout of 4294968us.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/rc/ir-lirc-codec.c

index bd046c41a53a588862e21c6cc557829e433b1ab4..8f2f37412fc5e24e90ebe763e16628ca8f7f6483 100644 (file)
@@ -298,11 +298,14 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
                if (!dev->max_timeout)
                        return -ENOTTY;
 
+               /* Check for multiply overflow */
+               if (val > U32_MAX / 1000)
+                       return -EINVAL;
+
                tmp = val * 1000;
 
-               if (tmp < dev->min_timeout ||
-                   tmp > dev->max_timeout)
-                               return -EINVAL;
+               if (tmp < dev->min_timeout || tmp > dev->max_timeout)
+                       return -EINVAL;
 
                if (dev->s_timeout)
                        ret = dev->s_timeout(dev, tmp);