Re: [PATCH] usb: don't trust report_size for buffer size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kees Cook wrote:
> 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;
>         }

You are right, I missed this condition.

>         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
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux