Re: [PATCH RFC] dwc2: Don't assume URB transfer_buffer are dword-aligned

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

 



Em Fri, 17 Mar 2017 10:24:15 +0900
Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> escreveu:

> On Thu, Mar 16, 2017 at 09:08:40PM -0300, Mauro Carvalho Chehab wrote:
> > The dwc2 hardware doesn't like to do DMA transfers without
> > aligning data in DWORD. The driver also assumes that, even
> > when there's no DMA, at dwc2_read_packet().
> > 
> > That cause buffer overflows, preventing some drivers to work.  
> 
> Why aren't the drivers being fixed?  This is a well-known (hopefully)
> restriction on USB data buffers, can't the uvc_driver be fixed?

I talked to Laurent about on IRC. He told that he is willing to consider
that option, if the USB API explicitly states that all buffers must be
dword-aligned (and/or buffer sizes).

IMHO, he has a point: if this is a restriction of for usb transfer
buffers, it should be documented somewhere.

Yet, a quick check with:
	$ git grep -i dword Documentation/usb/
	$ git grep -i align Documentation/usb/

Didn't hit anything related to it. 

> > In the specific case of uvc_driver, it uses an array where
> > it caches the content of video controls, passing it to the
> > USB stack via usb_control_msg(). Typical controls use 1 or 2
> > bytes. The net result is that other values of the buffer
> > gets overriden when this function is called.  
> 
> Not good, it should be fixed, otherwise you are going to have to try to
> fix up all host controllers :(
> 
> thanks,
> 
> greg k-h



Thanks,
Mauro
--
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