char: Int overflow in lp_do_ioctl().
authorYongjian Xu <xuyongjiande@gmail.com>
Wed, 18 Dec 2013 07:45:12 +0000 (15:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Dec 2013 00:39:54 +0000 (16:39 -0800)
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>
drivers/char/lp.c

index 0913d79424d3a3e81930a4c138979a621de18605..c4094c4e22c11dda9647d3d472a18203f98f9649 100644 (file)
@@ -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: