Skip to content

Commit

Permalink
OMAP:MUSB: Corrects urb unlink function path
Browse files Browse the repository at this point in the history
Fixes kernel panic while ISO IN transfer is aborted.Replaced
usb_hcd_unlink_urb_from_ep() from musb_giveback() to __musb_giveback()
to make sure urb is unlinked before giveback when __musb_giveback() is
called from musb_urb_dequeue().

Acquired musb->lock() before usb_hcd_unlink_urb_from_ep() within in
enqueue path.

Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ajay Kumar Gupta authored and Greg Kroah-Hartman committed Oct 17, 2008
1 parent ae5ad29 commit 2492e67
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/usb/musb/musb_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ __acquires(musb->lock)
urb->actual_length, urb->transfer_buffer_length
);

usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);
spin_unlock(&musb->lock);
usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status);
spin_lock(&musb->lock);
Expand Down Expand Up @@ -353,8 +354,6 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
break;
}

usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);

qh->is_ready = 0;
__musb_giveback(musb, urb, status);
qh->is_ready = ready;
Expand Down Expand Up @@ -1791,7 +1790,9 @@ static int musb_urb_enqueue(
*/
qh = kzalloc(sizeof *qh, mem_flags);
if (!qh) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&musb->lock, flags);
return -ENOMEM;
}

Expand Down Expand Up @@ -1907,7 +1908,9 @@ static int musb_urb_enqueue(

done:
if (ret != 0) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&musb->lock, flags);
kfree(qh);
}
return ret;
Expand Down

0 comments on commit 2492e67

Please sign in to comment.