Skip to content

Commit a7a3b07

Browse files
Henry Lingregkh
authored andcommitted
ALSA: usb-audio: not submit urb for stopped endpoint
commit 5286993 upstream. While output urb's snd_complete_urb() is executing, calling prepare_outbound_urb() may cause endpoint stopped before prepare_outbound_urb() returns and result in next urb submitted to stopped endpoint. usb-audio driver cannot re-use it afterwards as the urb is still hold by usb stack. This change checks EP_FLAG_RUNNING flag after prepare_outbound_urb() again to let snd_complete_urb() know the endpoint already stopped and does not submit next urb. Below kind of error will be fixed: [ 213.153103] usb 1-2: timeout: still 1 active urbs on EP #1 [ 213.164121] usb 1-2: cannot submit urb 0, error -16: unknown error Signed-off-by: Henry Lin <[email protected]> Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 524c3ea commit a7a3b07

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

sound/usb/endpoint.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,9 @@ static void snd_complete_urb(struct urb *urb)
403403
}
404404

405405
prepare_outbound_urb(ep, ctx);
406+
/* can be stopped during prepare callback */
407+
if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
408+
goto exit_clear;
406409
} else {
407410
retire_inbound_urb(ep, ctx);
408411
/* can be stopped during retire callback */

0 commit comments

Comments
 (0)