summaryrefslogtreecommitdiffstats
path: root/drivers/char/lp.c
diff options
context:
space:
mode:
authorYongjian Xu <xuyongjiande@gmail.com>2013-12-18 15:45:12 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-18 16:39:54 -0800
commit1c2de820d66d704c7d6fffdd872b7670eb4e29bb (patch)
treef86d9d46e7aaae7cee35ea4886ebaf5c6782086d /drivers/char/lp.c
parent138a6d7ea2deb3080116a4f99019e181b62e5ce5 (diff)
downloadop-kernel-dev-1c2de820d66d704c7d6fffdd872b7670eb4e29bb.zip
op-kernel-dev-1c2de820d66d704c7d6fffdd872b7670eb4e29bb.tar.gz
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/char/lp.c')
-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 0913d79..c4094c4 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:
OpenPOWER on IntegriCloud