Skip to content

Commit

Permalink
USB: usbfs: fix potential infoleak in devio
Browse files Browse the repository at this point in the history
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@gatech.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
kengiter authored and gregkh committed May 3, 2016
1 parent 9739861 commit 681fef8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions drivers/usb/core/devio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1316,10 +1316,11 @@ static int proc_getdriver(struct usb_dev_state *ps, void __user *arg)

static int proc_connectinfo(struct usb_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;
Expand Down

0 comments on commit 681fef8

Please sign in to comment.