05bf4c3
From 7adc5cbc25dcc47dc3856108d9823d08da75da9d Mon Sep 17 00:00:00 2001
05bf4c3
From: Kangjie Lu <kangjielu@gmail.com>
05bf4c3
Date: Tue, 3 May 2016 16:32:16 -0400
05bf4c3
Subject: [PATCH] USB: usbfs: fix potential infoleak in devio
05bf4c3
MIME-Version: 1.0
05bf4c3
Content-Type: text/plain; charset=UTF-8
05bf4c3
Content-Transfer-Encoding: 8bit
05bf4c3
05bf4c3
The stack object “ci” has a total size of 8 bytes. Its last 3 bytes
05bf4c3
are padding bytes which are not initialized and leaked to userland
05bf4c3
via “copy_to_user”.
05bf4c3
05bf4c3
Signed-off-by: Kangjie Lu <kjlu@gatech.edu>
05bf4c3
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
05bf4c3
---
05bf4c3
 drivers/usb/core/devio.c | 9 +++++----
05bf4c3
 1 file changed, 5 insertions(+), 4 deletions(-)
05bf4c3
05bf4c3
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
05bf4c3
index 52c4461dfccd..9b7f1f75e887 100644
05bf4c3
--- a/drivers/usb/core/devio.c
05bf4c3
+++ b/drivers/usb/core/devio.c
05bf4c3
@@ -1316,10 +1316,11 @@ static int proc_getdriver(struct usb_dev_state *ps, void __user *arg)
05bf4c3
 
05bf4c3
 static int proc_connectinfo(struct usb_dev_state *ps, void __user *arg)
05bf4c3
 {
05bf4c3
-	struct usbdevfs_connectinfo ci = {
05bf4c3
-		.devnum = ps->dev->devnum,
05bf4c3
-		.slow = ps->dev->speed == USB_SPEED_LOW
05bf4c3
-	};
05bf4c3
+	struct usbdevfs_connectinfo ci;
05bf4c3
+
05bf4c3
+	memset(&ci, 0, sizeof(ci));
05bf4c3
+	ci.devnum = ps->dev->devnum;
05bf4c3
+	ci.slow = ps->dev->speed == USB_SPEED_LOW;
05bf4c3
 
05bf4c3
 	if (copy_to_user(arg, &ci, sizeof(ci)))
05bf4c3
 		return -EFAULT;
05bf4c3
-- 
05bf4c3
2.5.5
05bf4c3