]> git.karo-electronics.de Git - linux-beck.git/commitdiff
tty: an overflow of multiplication in drivers/tty/cyclades.c
authorQixue Xiao <s2exqx@gmail.com>
Fri, 20 Dec 2013 09:51:12 +0000 (17:51 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 20 Dec 2013 20:21:57 +0000 (12:21 -0800)
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 <xiaoqixue_1@163.com>
Suggested-by: Yongjian Xu <xuyongjiande@gmail.com>
Suggested-by: Yu Chen <chyyuu@gmail.com>
Signed-off-by: Qixue Xiao <xiaoqixue_1@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/cyclades.c

index 33f83fee9faec6be78206ebbc4aeee5ba1702fc8..a57bb5ab761cec2619c8ae065fce210d9b0451d0 100644 (file)
@@ -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: