Skip to content

Commit d5d5f07

Browse files
Artur PetrosyanFelipe Balbi
authored andcommitted
usb: dwc2: Fix crash in incomplete isoc intr handlers.
Crash caused by going out of "eps_out" array range. Iteration on "eps_out" changed to less than "num_of_eps". Signed-off-by: Artur Petrosyan <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent b43ebc9 commit d5d5f07

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/dwc2/gadget.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3409,7 +3409,7 @@ static void dwc2_gadget_handle_incomplete_isoc_in(struct dwc2_hsotg *hsotg)
34093409

34103410
daintmsk = dwc2_readl(hsotg->regs + DAINTMSK);
34113411

3412-
for (idx = 1; idx <= hsotg->num_of_eps; idx++) {
3412+
for (idx = 1; idx < hsotg->num_of_eps; idx++) {
34133413
hs_ep = hsotg->eps_in[idx];
34143414
/* Proceed only unmasked ISOC EPs */
34153415
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk))
@@ -3455,7 +3455,7 @@ static void dwc2_gadget_handle_incomplete_isoc_out(struct dwc2_hsotg *hsotg)
34553455
daintmsk = dwc2_readl(hsotg->regs + DAINTMSK);
34563456
daintmsk >>= DAINT_OUTEP_SHIFT;
34573457

3458-
for (idx = 1; idx <= hsotg->num_of_eps; idx++) {
3458+
for (idx = 1; idx < hsotg->num_of_eps; idx++) {
34593459
hs_ep = hsotg->eps_out[idx];
34603460
/* Proceed only unmasked ISOC EPs */
34613461
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk))
@@ -3629,7 +3629,7 @@ static irqreturn_t dwc2_hsotg_irq(int irq, void *pw)
36293629
dwc2_writel(gintmsk, hsotg->regs + GINTMSK);
36303630

36313631
dev_dbg(hsotg->dev, "GOUTNakEff triggered\n");
3632-
for (idx = 1; idx <= hsotg->num_of_eps; idx++) {
3632+
for (idx = 1; idx < hsotg->num_of_eps; idx++) {
36333633
hs_ep = hsotg->eps_out[idx];
36343634
/* Proceed only unmasked ISOC EPs */
36353635
if (!hs_ep->isochronous || (BIT(idx) & ~daintmsk))

0 commit comments

Comments
 (0)