Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0cbab077 authored by Sean Young's avatar Sean Young Committed by Greg Kroah-Hartman
Browse files

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: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d4674227
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -289,10 +289,13 @@ 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)
		if (tmp < dev->min_timeout || tmp > dev->max_timeout)
			return -EINVAL;

		dev->timeout = tmp;