Skip to content

Commit

Permalink
char: Int overflow in lp_do_ioctl().
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yongjian Xu authored and gregkh committed Dec 19, 2013
1 parent 138a6d7 commit 1c2de82
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/char/lp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 1c2de82

Please sign in to comment.