summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorYongjian Xu <xuyongjiande@gmail.com>2013-12-18 11:45:12 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-19 04:39:54 +0400
commit1c2de820d66d704c7d6fffdd872b7670eb4e29bb (patch)
treef86d9d46e7aaae7cee35ea4886ebaf5c6782086d /drivers
parent138a6d7ea2deb3080116a4f99019e181b62e5ce5 (diff)
downloadlinux-1c2de820d66d704c7d6fffdd872b7670eb4e29bb.tar.xz
char: Int overflow in lp_do_ioctl().
arg comes from user-space, so int overflow may occur: LP_TIME(minor) = arg * HZ/100; Reported-by: Yongjian Xu <xuyongjiande@gmail.com> Suggested-by: Qixue Xiao <s2exqx@gmail.com> Signed-off-by: Yu Chen <chyyuu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/char/lp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/char/lp.c b/drivers/char/lp.c
index 0913d79424d3..c4094c4e22c1 100644
--- a/drivers/char/lp.c
+++ b/drivers/char/lp.c
@@ -587,6 +587,8 @@ static int lp_do_ioctl(unsigned int minor, unsigned int cmd,
return -ENODEV;
switch ( cmd ) {
case LPTIME:
+ if (arg > UINT_MAX / HZ)
+ return -EINVAL;
LP_TIME(minor) = arg * HZ/100;
break;
case LPCHAR: