Commit 3067779b authored by yuzheng ma's avatar yuzheng ma Committed by Felipe Balbi

usb: musb: host: fix for musb_start_urb Oops

when using musb_urb_enqueue to submit three urbs to the same endpoint, when
hep->hcpriv is NULL, qh will be allocated when the first urb is completed.

When the IRQ completes the next two urbs, qh->hep->hcpriv will be set to NULL.
Now the second urb get musb->lock and executes musb_schedule(), but
next_urb(qh) is NULL, so musb_start_urb will Oops.

[ balbi@ti.com : practically rewrote commit log so it makes sense ]
Signed-off-by: default avatarmayuzheng <myz147@gmail.com>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 3b9c1c5b
...@@ -2049,7 +2049,7 @@ static int musb_urb_enqueue( ...@@ -2049,7 +2049,7 @@ static int musb_urb_enqueue(
* we only have work to do in the former case. * we only have work to do in the former case.
*/ */
spin_lock_irqsave(&musb->lock, flags); spin_lock_irqsave(&musb->lock, flags);
if (hep->hcpriv) { if (hep->hcpriv || !next_urb(qh)) {
/* some concurrent activity submitted another urb to hep... /* some concurrent activity submitted another urb to hep...
* odd, rare, error prone, but legal. * odd, rare, error prone, but legal.
*/ */
......
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