summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasiliy Kulikov <segooon@gmail.com>2010-11-06 17:41:28 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2010-12-09 13:24:18 -0800
commit3ddf4f97bee674e72412d9b0a3be2695d80dad3a (patch)
treeb6baa2bfd2e2af4f72ecdda3849b08cb5e325035
parent82d1639ec939d83169f0b556a29c711e43a0290e (diff)
downloadlwn-3ddf4f97bee674e72412d9b0a3be2695d80dad3a.tar.gz
lwn-3ddf4f97bee674e72412d9b0a3be2695d80dad3a.zip
usb: core: fix information leak to userland
commit 886ccd4520064408ce5876cfe00554ce52ecf4a7 upstream. Structure usbdevfs_connectinfo is copied to userland with padding byted after "slow" field uninitialized. It leads to leaking of contents of kernel stack memory. Signed-off-by: Vasiliy Kulikov <segooon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/devio.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 8657266f268b..a3397c8d68a4 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -883,10 +883,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;
+ struct usbdevfs_connectinfo ci = {
+ .devnum = ps->dev->devnum,
+ .slow = ps->dev->speed == USB_SPEED_LOW
+ };
- ci.devnum = ps->dev->devnum;
- ci.slow = ps->dev->speed == USB_SPEED_LOW;
if (copy_to_user(arg, &ci, sizeof(ci)))
return -EFAULT;
return 0;