summaryrefslogtreecommitdiffstats
path: root/drivers/char/lp.c
diff options
context:
space:
mode:
authorYongjian Xu <xuyongjiande@gmail.com>2013-12-18 08:45:12 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-19 01:39:54 +0100
commit1c2de820d66d704c7d6fffdd872b7670eb4e29bb (patch)
treef86d9d46e7aaae7cee35ea4886ebaf5c6782086d /drivers/char/lp.c
parentMerge 3.13-rc4 into char-misc-next (diff)
downloadlinux-1c2de820d66d704c7d6fffdd872b7670eb4e29bb.tar.xz
linux-1c2de820d66d704c7d6fffdd872b7670eb4e29bb.zip
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 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: