Skip to content

Commit d758f4d

Browse files
seanyounggregkh
authored andcommitted
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>
1 parent 878c0f9 commit d758f4d

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/media/rc/ir-lirc-codec.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,14 @@ static long ir_lirc_ioctl(struct file *filep, unsigned int cmd,
286286
if (!dev->max_timeout)
287287
return -ENOSYS;
288288

289+
/* Check for multiply overflow */
290+
if (val > U32_MAX / 1000)
291+
return -EINVAL;
292+
289293
tmp = val * 1000;
290294

291-
if (tmp < dev->min_timeout ||
292-
tmp > dev->max_timeout)
293-
return -EINVAL;
295+
if (tmp < dev->min_timeout || tmp > dev->max_timeout)
296+
return -EINVAL;
294297

295298
dev->timeout = tmp;
296299
break;

0 commit comments

Comments
 (0)