Commit 2492e674 authored by Ajay Kumar Gupta's avatar Ajay Kumar Gupta Committed by Greg Kroah-Hartman

OMAP:MUSB: Corrects urb unlink function path

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: default avatarAjay Kumar Gupta <ajay.gupta@ti.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent ae5ad296
...@@ -291,6 +291,7 @@ __acquires(musb->lock) ...@@ -291,6 +291,7 @@ __acquires(musb->lock)
urb->actual_length, urb->transfer_buffer_length urb->actual_length, urb->transfer_buffer_length
); );
usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);
spin_unlock(&musb->lock); spin_unlock(&musb->lock);
usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status); usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status);
spin_lock(&musb->lock); spin_lock(&musb->lock);
...@@ -353,8 +354,6 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status) ...@@ -353,8 +354,6 @@ musb_giveback(struct musb_qh *qh, struct urb *urb, int status)
break; break;
} }
usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb);
qh->is_ready = 0; qh->is_ready = 0;
__musb_giveback(musb, urb, status); __musb_giveback(musb, urb, status);
qh->is_ready = ready; qh->is_ready = ready;
...@@ -1791,7 +1790,9 @@ static int musb_urb_enqueue( ...@@ -1791,7 +1790,9 @@ static int musb_urb_enqueue(
*/ */
qh = kzalloc(sizeof *qh, mem_flags); qh = kzalloc(sizeof *qh, mem_flags);
if (!qh) { if (!qh) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb); usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&musb->lock, flags);
return -ENOMEM; return -ENOMEM;
} }
...@@ -1907,7 +1908,9 @@ static int musb_urb_enqueue( ...@@ -1907,7 +1908,9 @@ static int musb_urb_enqueue(
done: done:
if (ret != 0) { if (ret != 0) {
spin_lock_irqsave(&musb->lock, flags);
usb_hcd_unlink_urb_from_ep(hcd, urb); usb_hcd_unlink_urb_from_ep(hcd, urb);
spin_unlock_irqrestore(&musb->lock, flags);
kfree(qh); kfree(qh);
} }
return ret; return ret;
......
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