USB: usbfs: fix potential infoleak in devio
Kangjie Lu [Tue, 3 May 2016 20:32:16 +0000 (16:32 -0400)]
The stack object “ci” has a total size of 8 bytes. Its last 3 bytes
are padding bytes which are not initialized and leaked to userland
via “copy_to_user”.

CVE-2016-4482
Bug 1787007

Change-Id: I1488436e8322fd645f76c942aeae1daada6be995
(cherry picked from commit 681fef8380eb818c0b845fca5d2ab1dcbab114ee)

Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Rohith Seelaboyina <rseelaboyina@nvidia.com>
Signed-off-by: Dhiren Parmar <dparmar@nvidia.com>
Change-Id: I1488436e8322fd645f76c942aeae1daada6be995
Reviewed-on: http://git-master/r/1190551
(cherry picked from commit 0dee449c60dec829c02084d4e10ae373c1ebbd6e)
Reviewed-on: http://git-master/r/1195841
GVS: Gerrit_Virtual_Submit

drivers/usb/core/devio.c

index 62e532f..cfce807 100644 (file)
@@ -1106,10 +1106,11 @@ static int proc_getdriver(struct dev_state *ps, void __user *arg)
 
 static int proc_connectinfo(struct dev_state *ps, void __user *arg)
 {
-       struct usbdevfs_connectinfo ci = {
-               .devnum = ps->dev->devnum,
-               .slow = ps->dev->speed == USB_SPEED_LOW
-       };
+       struct usbdevfs_connectinfo ci;
+
+       memset(&ci, 0, sizeof(ci));
+       ci.devnum = ps->dev->devnum;
+       ci.slow = ps->dev->speed == USB_SPEED_LOW;
 
        if (copy_to_user(arg, &ci, sizeof(ci)))
                return -EFAULT;