[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.44L0.1011061419490.28403-100000@netrider.rowland.org>
Date: Sat, 6 Nov 2010 14:21:50 -0400 (EDT)
From: Alan Stern <stern@...land.harvard.edu>
To: Vasiliy Kulikov <segooon@...il.com>
cc: kernel-janitors@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...e.de>,
Oliver Neukum <oliver@...kum.org>,
Andi Kleen <ak@...ux.intel.com>,
Chris Frey <cdfrey@...rsquare.net>,
<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] usb: core: fix information leak to userland
On Sat, 6 Nov 2010, Vasiliy Kulikov wrote:
> 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@...il.com>
> ---
> Compile tested.
>
> drivers/usb/core/devio.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index f1aaff6..045bb4b 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -965,10 +965,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;
Are you sure that adding an initializer like this will zero out the
padding bytes? It might be safer just to call memset. This is not
exactly a hot path, after all.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists