Skip to content

Commit 681fef8

Browse files
kengitergregkh
authored andcommitted
USB: usbfs: fix potential infoleak in devio
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9739861 commit 681fef8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/usb/core/devio.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -1316,10 +1316,11 @@ static int proc_getdriver(struct usb_dev_state *ps, void __user *arg)
13161316

13171317
static int proc_connectinfo(struct usb_dev_state *ps, void __user *arg)
13181318
{
1319-
struct usbdevfs_connectinfo ci = {
1320-
.devnum = ps->dev->devnum,
1321-
.slow = ps->dev->speed == USB_SPEED_LOW
1322-
};
1319+
struct usbdevfs_connectinfo ci;
1320+
1321+
memset(&ci, 0, sizeof(ci));
1322+
ci.devnum = ps->dev->devnum;
1323+
ci.slow = ps->dev->speed == USB_SPEED_LOW;
13231324

13241325
if (copy_to_user(arg, &ci, sizeof(ci)))
13251326
return -EFAULT;

0 commit comments

Comments
 (0)