aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorClemens Gruber <clemens.gruber@pqgruber.com>2016-09-05 13:29:58 -0400
committerPeter Chen <peter.chen@nxp.com>2016-09-09 05:19:57 -0400
commit6f3c4fb6d05e63c9c6d8968302491c3a5457be61 (patch)
tree26dae4806595cc0b4a62e930a2352cad5cce812a /drivers/usb/chipidea
parentc4e94174983a86c935be1537a73e496b778b0287 (diff)
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: <stable@vger.kernel.org> #4.1+ Signed-off-by: Clemens Gruber <clemens.gruber@pqgruber.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/udc.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index dfec5a176315..b93356834bb5 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -949,6 +949,15 @@ static int isr_setup_status_phase(struct ci_hdrc *ci)
949 int retval; 949 int retval;
950 struct ci_hw_ep *hwep; 950 struct ci_hw_ep *hwep;
951 951
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
952 hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in; 961 hwep = (ci->ep0_dir == TX) ? ci->ep0out : ci->ep0in;
953 ci->status->context = ci; 962 ci->status->context = ci;
954 ci->status->complete = isr_setup_status_complete; 963 ci->status->complete = isr_setup_status_complete;