Skip to content

Commit 6f3c4fb

Browse files
clemensgPeter Chen
authored andcommitted
usb: chipidea: udc: fix NULL ptr dereference in isr_setup_status_phase
Problems with the signal integrity of the high speed USB data lines or noise on reference ground lines can cause the i.MX6 USB controller to violate USB specs and exhibit unexpected behavior. It was observed that USBi_UI interrupts were triggered first and when isr_setup_status_phase was called, ci->status was NULL, which lead to a NULL pointer dereference kernel panic. This patch fixes the kernel panic, emits a warning once and returns -EPIPE to halt the device and let the host get stalled. It also adds a comment to point people, who are experiencing this issue, to their USB hardware design. Cc: <[email protected]> #4.1+ Signed-off-by: Clemens Gruber <[email protected]> Signed-off-by: Peter Chen <[email protected]>
1 parent c4e9417 commit 6f3c4fb

File tree

1 file changed

+9
-0
lines changed
  • drivers/usb/chipidea

1 file changed

+9
-0
lines changed

drivers/usb/chipidea/udc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,15 @@ static int isr_setup_status_phase(struct ci_hdrc *ci)
949949
int retval;
950950
struct ci_hw_ep *hwep;
951951

952+
/*
953+
* Unexpected USB controller behavior, caused by bad signal integrity
954+
* or ground reference problems, can lead to isr_setup_status_phase
955+
* being called with ci->status equal to NULL.
956+
* If this situation occurs, you should review your USB hardware design.
957+
*/
958+
if (WARN_ON_ONCE(!ci->status))
959+
return -EPIPE;
960+
952961
hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
953962
ci->status->context = ci;
954963
ci->status->complete = isr_setup_status_complete;

0 commit comments

Comments
 (0)