mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kees Cook <kees.cook@canonical.com>
To: "Németh Márton" <nm127@freemail.hu>
Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
	Oliver Neukum <oliver@neukum.org>, Joe Perches <joe@perches.com>,
	linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: don't trust report_size for buffer size
Date: Mon, 11 Oct 2010 12:11:19 -0700	[thread overview]
Message-ID: <20101011191119.GN4991@outflux.net> (raw)
In-Reply-To: <4CB35D4C.9000406@freemail.hu>

Hi Németh,

On Mon, Oct 11, 2010 at 08:54:04PM +0200, Németh Márton wrote:
> There might be similar problem also in the case USB_DEVICE_ID_CODEMERCS_IOW56. There
> is buf is allocated with usb_alloc_coherent() to the size dev->report_size. However,
> some lines later the copy_from_user() function tries to copy "count" number of
> bytes to the dev->report_size allocated buffer. Unfortunately I don't have such
> devices to try the driver so these are just coming from "static analysis".

I don't think the USB_DEVICE_ID_CODEMERCS_IOW56 path is a problem:

        if (count != dev->report_size) {
                retval = -EINVAL;
                goto exit;
        }
        switch (dev->product_id) {
...
        case USB_DEVICE_ID_CODEMERCS_IOW56:
...
                buf = usb_alloc_coherent(dev->udev, dev->report_size,
                                         GFP_KERNEL, &int_out_urb->transfer_dma);
...
                if (copy_from_user(buf, user_buffer, count)) {

i.e. count must == dev->report_size, and the buf is allocated with size
dev->report_size even though copy_from_user uses "count".

-Kees

-- 
Kees Cook
Ubuntu Security Team

  reply	other threads:[~2010-10-11 19:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-11 18:28 Kees Cook
2010-10-11 18:54 ` Németh Márton
2010-10-11 19:11   ` Kees Cook [this message]
2010-10-11 19:34     ` Németh Márton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101011191119.GN4991@outflux.net \
    --to=kees.cook@canonical.com \
    --cc=gregkh@suse.de \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nm127@freemail.hu \
    --cc=oliver@neukum.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®