Skip to content

Commit 3c3bf0a

Browse files
P33Mpopcornmix
authored andcommitted
Revert "usb: dwc2: use temporary URB buffer for small control transfers"
This incorrectly matches on urb->setup_packet instead of checking the pipe type, so recycled URBs were incorrectly matched. A more comprehensive fix is forthcoming. This reverts commit 2f27224. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
1 parent bae1357 commit 3c3bf0a

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

drivers/usb/dwc2/hcd.c

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2469,23 +2469,10 @@ static int dwc2_alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags)
24692469
{
24702470
void *kmalloc_ptr;
24712471
size_t kmalloc_size;
2472-
bool small_ctrl;
24732472

2474-
if (urb->num_sgs || urb->sg || urb->transfer_buffer_length == 0)
2475-
return 0;
2476-
2477-
/*
2478-
* Hardware bug: small IN packets with length < 4 cause a
2479-
* 4-byte write to memory. This is only an issue for drivers that
2480-
* insist on packing a device's various properties into a struct
2481-
* and filling them one at a time with Control transfers (uvcvideo).
2482-
* Force the use of align_buf so that the subsequent memcpy puts
2483-
* the right number of bytes in the URB's buffer.
2484-
*/
2485-
small_ctrl = (urb->setup_packet &&
2486-
le16_to_cpu(((struct usb_ctrlrequest *)(urb->setup_packet))->wLength) < 4);
2487-
2488-
if (!small_ctrl && !((uintptr_t)urb->transfer_buffer & (DWC2_USB_DMA_ALIGN - 1)))
2473+
if (urb->num_sgs || urb->sg ||
2474+
urb->transfer_buffer_length == 0 ||
2475+
!((uintptr_t)urb->transfer_buffer & (DWC2_USB_DMA_ALIGN - 1)))
24892476
return 0;
24902477

24912478
/*

0 commit comments

Comments
 (0)