Commit 118d63f7 authored by Peter Chen's avatar Peter Chen Committed by Felipe Balbi

usb: gadget: fsl_udc: fix the usage of udc->max_ep

The max_ep is the number of endpoint * 2.

But in dtd_complete_irq, it does again * 2, it will deference wrong memory
after scanning max_ep - 1.

The another similar problem is at USB_REQ_SET_FEATURE (the pipe number
should be 0 and max_ep - 1).
Signed-off-by: default avatarPeter Chen <peter.chen@freescale.com>
Signed-off-by: default avatarMatthieu castet <matthieu.castet@parrot.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent a37670b1
...@@ -1430,7 +1430,7 @@ static void setup_received_irq(struct fsl_udc *udc, ...@@ -1430,7 +1430,7 @@ static void setup_received_irq(struct fsl_udc *udc,
int pipe = get_pipe_by_windex(wIndex); int pipe = get_pipe_by_windex(wIndex);
struct fsl_ep *ep; struct fsl_ep *ep;
if (wValue != 0 || wLength != 0 || pipe > udc->max_ep) if (wValue != 0 || wLength != 0 || pipe >= udc->max_ep)
break; break;
ep = get_ep_by_pipe(udc, pipe); ep = get_ep_by_pipe(udc, pipe);
...@@ -1673,7 +1673,7 @@ static void dtd_complete_irq(struct fsl_udc *udc) ...@@ -1673,7 +1673,7 @@ static void dtd_complete_irq(struct fsl_udc *udc)
if (!bit_pos) if (!bit_pos)
return; return;
for (i = 0; i < udc->max_ep * 2; i++) { for (i = 0; i < udc->max_ep; i++) {
ep_num = i >> 1; ep_num = i >> 1;
direction = i % 2; direction = i % 2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment