[PATCH 3.12 69/88] USB: usbfs: fix potential infoleak in devio
From: Jiri Slaby
Date: Thu Jul 14 2016 - 04:24:19 EST
From: Kangjie Lu <kangjielu@xxxxxxxxx>
3.12-stable review patch. If anyone has any objections, please let me know.
===============
commit 681fef8380eb818c0b845fca5d2ab1dcbab114ee upstream.
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â.
Signed-off-by: Kangjie Lu <kjlu@xxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Signed-off-by: Jiri Slaby <jslaby@xxxxxxx>
---
drivers/usb/core/devio.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index c076050cab47..a7b10c18759c 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -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;
--
2.9.1