dwc_otg: use align_buf for small IN control transfers (#3150)
authorP33M <2474547+P33M@users.noreply.github.com>
Wed, 14 Aug 2019 13:35:50 +0000 (14:35 +0100)
committerPhil Elwell <pelwell@users.noreply.github.com>
Wed, 14 Aug 2019 13:35:50 +0000 (14:35 +0100)
commitc0e4ca17457d6669a263e86a88f0036875fc019e
treeeaa5ad7dc269b0b3407fe66bdcf82fb99f8b3752
parent5f945aad8e7668a6f59b281c60aad87524a32a15
dwc_otg: use align_buf for small IN control transfers (#3150)

The hardware will do a 4-byte write to memory on any IN packet received
that is between 1 and 3 bytes long. This tramples memory in the uvcvideo
driver, as it uses a sequence of 1- and 2-byte control transfers to
query the min/max/range/step of each individual camera control and
gives us buffers that are offsets into a struct.

Catch small control transfers in the data phase and use the align_buf
to bounce the correct number of bytes into the URB's buffer.

In general, short packets on non-control endpoints should be OK as URBs
should have enough buffer space for a wMaxPacket size transfer.

See: https://github.com/raspberrypi/linux/issues/3148

Signed-off-by: Jonathan Bell <jonathan@raspberrypi.org>
drivers/usb/host/dwc_otg/dwc_otg_hcd.c