summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2017-10-08 14:18:52 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-11-30 08:35:53 +0000
commit0cbab0776bd74966db8a6829b423dd42295e3580 (patch)
tree0e9925444f944c346935b78f9902ff450d271bdd /drivers
parentd4674227f40f47734d1c1575445a4f7cee2494f8 (diff)
downloadlinux-stable-0cbab0776bd74966db8a6829b423dd42295e3580.tar.gz
linux-stable-0cbab0776bd74966db8a6829b423dd42295e3580.tar.bz2
linux-stable-0cbab0776bd74966db8a6829b423dd42295e3580.zip
media: rc: check for integer overflow
commit 3e45067f94bbd61dec0619b1c32744eb0de480c8 upstream. The ioctl LIRC_SET_REC_TIMEOUT would set a timeout of 704ns if called with a timeout of 4294968us. Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/rc/ir-lirc-codec.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 98893a8332c7..080130582303 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -289,11 +289,14 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
if (!dev->max_timeout)
return -ENOSYS;
+ /* 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;
dev->timeout = tmp;
break;