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>
This commit is contained in:
parent
c451af324c
commit
bcd2dc9e32
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user