提交 89066b36 编写于 作者: J John Keeping 提交者: Felipe Balbi

usb: dwc2: avoid NULL dereferences

For unidirectional endpoints, the endpoint pointer will be NULL for the
unused direction.  Check that the endpoint is active before
dereferencing this pointer.

Fixes: 1b4977c7 ("usb: dwc2: Update dwc2_handle_incomplete_isoc_in() function")
Fixes: 689efb26 ("usb: dwc2: Update dwc2_handle_incomplete_isoc_out() function")
Fixes: d8484552 ("usb: dwc2: Update GINTSTS_GOUTNAKEFF interrupt handling")
Signed-off-by: NJohn Keeping <john@metanate.com>
Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
上级 a39ba90a
...@@ -3430,7 +3430,7 @@ static void dwc2_gadget_handle_incomplete_isoc_in(struct dwc2_hsotg *hsotg) ...@@ -3430,7 +3430,7 @@ static void dwc2_gadget_handle_incomplete_isoc_in(struct dwc2_hsotg *hsotg)
for (idx = 1; idx < hsotg->num_of_eps; idx++) { for (idx = 1; idx < hsotg->num_of_eps; idx++) {
hs_ep = hsotg->eps_in[idx]; hs_ep = hsotg->eps_in[idx];
/* Proceed only unmasked ISOC EPs */ /* Proceed only unmasked ISOC EPs */
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous)
continue; continue;
epctrl = dwc2_readl(hsotg->regs + DIEPCTL(idx)); epctrl = dwc2_readl(hsotg->regs + DIEPCTL(idx));
...@@ -3476,7 +3476,7 @@ static void dwc2_gadget_handle_incomplete_isoc_out(struct dwc2_hsotg *hsotg) ...@@ -3476,7 +3476,7 @@ static void dwc2_gadget_handle_incomplete_isoc_out(struct dwc2_hsotg *hsotg)
for (idx = 1; idx < hsotg->num_of_eps; idx++) { for (idx = 1; idx < hsotg->num_of_eps; idx++) {
hs_ep = hsotg->eps_out[idx]; hs_ep = hsotg->eps_out[idx];
/* Proceed only unmasked ISOC EPs */ /* Proceed only unmasked ISOC EPs */
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous)
continue; continue;
epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx)); epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx));
...@@ -3650,7 +3650,7 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw) ...@@ -3650,7 +3650,7 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
for (idx = 1; idx < hsotg->num_of_eps; idx++) { for (idx = 1; idx < hsotg->num_of_eps; idx++) {
hs_ep = hsotg->eps_out[idx]; hs_ep = hsotg->eps_out[idx];
/* Proceed only unmasked ISOC EPs */ /* Proceed only unmasked ISOC EPs */
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk)) if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous)
continue; continue;
epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx)); epctrl = dwc2_readl(hsotg->regs + DOEPCTL(idx));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册