diff options
author | Yongjian Xu <xuyongjiande@gmail.com> | 2013-12-18 02:45:12 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-12-18 19:39:54 -0500 |
commit | 1c2de820d66d704c7d6fffdd872b7670eb4e29bb (patch) | |
tree | f86d9d46e7aaae7cee35ea4886ebaf5c6782086d /drivers/char/lp.c | |
parent | 138a6d7ea2deb3080116a4f99019e181b62e5ce5 (diff) |
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.c | 2 |
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, | |||
587 | return -ENODEV; | 587 | return -ENODEV; |
588 | switch ( cmd ) { | 588 | switch ( cmd ) { |
589 | case LPTIME: | 589 | case LPTIME: |
590 | if (arg > UINT_MAX / HZ) | ||
591 | return -EINVAL; | ||
590 | LP_TIME(minor) = arg * HZ/100; | 592 | LP_TIME(minor) = arg * HZ/100; |
591 | break; | 593 | break; |
592 | case LPCHAR: | 594 | case LPCHAR: |