diff options
author | Sean Young <sean@mess.org> | 2017-10-08 21:18:52 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-11-30 11:39:09 +0300 |
commit | bcd2dc9e329b3cf76cda88732f09aac4157fc5da (patch) | |
tree | 6cd7869e2c878c6cd8b53b6283840b4bf38928c3 /drivers/media | |
parent | c451af324cf252a5745e967c993c32a83e37f352 (diff) | |
download | linux-bcd2dc9e329b3cf76cda88732f09aac4157fc5da.tar.xz |
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/media')
-rw-r--r-- | drivers/media/rc/ir-lirc-codec.c | 9 |
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 b49f80cb49c9..d9a5710532f4 100644 --- a/drivers/media/rc/ir-lirc-codec.c +++ b/drivers/media/rc/ir-lirc-codec.c @@ -286,11 +286,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; if (dev->s_timeout) ret = dev->s_timeout(dev, tmp); |