From: Qixue Xiao Date: Fri, 20 Dec 2013 09:51:12 +0000 (+0800) Subject: tty: an overflow of multiplication in drivers/tty/cyclades.c X-Git-Tag: firefly_0821_release~176^2~4543^2~15 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=351d6204bfc814a1aee300296d2f54460ffff172;p=firefly-linux-kernel-4.4.55.git tty: an overflow of multiplication in drivers/tty/cyclades.c there is an overflow in the code : cyz_polling_cycle = (arg * HZ) / 1000, the multiplicator arg comes from user, so it may be an overflow if arg is a big number. And the value of cyc_polling_cycle will be wrong when it is used next time. Reported-by: Qixue Xiao Suggested-by: Yongjian Xu Suggested-by: Yu Chen Signed-off-by: Qixue Xiao Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c index 33f83fee9fae..a57bb5ab761c 100644 --- a/drivers/tty/cyclades.c +++ b/drivers/tty/cyclades.c @@ -2709,6 +2709,8 @@ cy_ioctl(struct tty_struct *tty, break; #ifndef CONFIG_CYZ_INTR case CYZSETPOLLCYCLE: + if (arg > LONG_MAX / HZ) + return -ENODEV; cyz_polling_cycle = (arg * HZ) / 1000; break; case CYZGETPOLLCYCLE: