[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1387328429-15172-1-git-send-email-xiaoqixue_1@163.com>
Date: Wed, 18 Dec 2013 09:00:29 +0800
From: xqx12 <s2exqx@...il.com>
To: gregkh@...uxfoundation.org, jslaby@...e.cz
Cc: linux-kernel@...r.kernel.org, chyyuu@...il.com,
xuyongjiande@...il.com, xqx12 <xiaoqixue_1@....com>
Subject: [PATCH] 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 <xiaoqixue_1@....com>
Suggested-by: Yongjian Xu <xuyongjiande@...il.com>
Suggested-by: Yu Chen <chyyuu@...il.com>
Signed-off-by: Qixue Xiao <xiaoqixue_1@....com>
---
drivers/tty/cyclades.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/tty/cyclades.c b/drivers/tty/cyclades.c
index 33f83fe..a57bb5a 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:
--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists