Skip to content

Commit 5286993

Browse files
Henry Lintiwai
authored andcommitted
ALSA: usb-audio: not submit urb for stopped endpoint
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]>
1 parent a7d0358 commit 5286993

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
@@ -388,6 +388,9 @@ static void snd_complete_urb(struct urb *urb)
388388
}
389389

390390
prepare_outbound_urb(ep, ctx);
391+
/* can be stopped during prepare callback */
392+
if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
393+
goto exit_clear;
391394
} else {
392395
retire_inbound_urb(ep, ctx);
393396
/* can be stopped during retire callback */

0 commit comments

Comments
 (0)