Skip to content

Commit

Permalink
tty: an overflow of multiplication in drivers/tty/cyclades.c
Browse files Browse the repository at this point in the history
there is an overflow in the code :
cyz_polling_cycle = (arg * HZ) / 1000,
the multiplicator arg comes from user, so it may be an overflow if
arg is a big number. And the value of cyc_polling_cycle will be
wrong when it is used next time.

Reported-by: Qixue Xiao <[email protected]>
Suggested-by: Yongjian Xu <[email protected]>
Suggested-by: Yu Chen <[email protected]>
Signed-off-by: Qixue Xiao <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
xiaoqx authored and gregkh committed Dec 20, 2013
1 parent 4903713 commit 351d620
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/tty/cyclades.c
Original file line number Diff line number Diff line change
Expand Up @@ -2709,6 +2709,8 @@ cy_ioctl(struct tty_struct *tty,
break;
#ifndef CONFIG_CYZ_INTR
case CYZSETPOLLCYCLE:
if (arg > LONG_MAX / HZ)
return -ENODEV;
cyz_polling_cycle = (arg * HZ) / 1000;
break;
case CYZGETPOLLCYCLE:
Expand Down

0 comments on commit 351d620

Please sign in to comment.