drivers/char/ppdev.c: fix information leak to userland
authorVasiliy Kulikov <segooon@gmail.com>
Wed, 27 Oct 2010 22:34:21 +0000 (15:34 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 28 Oct 2010 01:03:14 +0000 (18:03 -0700)
Structure par_timeout is copied to userland with some padding fields
unitialized.  Field tv_usec has type __kernel_suseconds_t, it differs from
tv_sec's type on some architectures.  It leads to leaking of stack memory.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/char/ppdev.c

index 723152d978a9482ac3c1e48c2724894a9d6cceb4..f176dbaeb15adfaaceda46ad6bd97e030065ccd8 100644 (file)
@@ -613,6 +613,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 
        case PPGETTIME:
                to_jiffies = pp->pdev->timeout;
+               memset(&par_timeout, 0, sizeof(par_timeout));
                par_timeout.tv_sec = to_jiffies / HZ;
                par_timeout.tv_usec = (to_jiffies % (long)HZ) * (1000000/HZ);
                if (copy_to_user (argp, &par_timeout, sizeof(struct timeval)))