Commit 3e45067f authored by Sean Young's avatar Sean Young Committed by Mauro Carvalho Chehab

media: rc: check for integer overflow

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: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 5ce8c7a0
...@@ -298,10 +298,13 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, ...@@ -298,10 +298,13 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
if (!dev->max_timeout) if (!dev->max_timeout)
return -ENOTTY; return -ENOTTY;
/* Check for multiply overflow */
if (val > U32_MAX / 1000)
return -EINVAL;
tmp = val * 1000; tmp = val * 1000;
if (tmp < dev->min_timeout || if (tmp < dev->min_timeout || tmp > dev->max_timeout)
tmp > dev->max_timeout)
return -EINVAL; return -EINVAL;
if (dev->s_timeout) if (dev->s_timeout)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment