summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenry Lin <henryl@nvidia.com>2019-11-13 10:14:19 +0800
committerBen Hutchings <ben@decadent.org.uk>2019-12-19 15:59:00 +0000
commit17f104db030b5cc871c3a2977a8023ed7cee62b1 (patch)
tree325c372377d08f16bad0a48066912af74f1320c9
parentded0d65fd775966a5115c0468dd02eda4cb855a1 (diff)
downloadlinux-stable-17f104db030b5cc871c3a2977a8023ed7cee62b1.tar.gz
linux-stable-17f104db030b5cc871c3a2977a8023ed7cee62b1.tar.bz2
linux-stable-17f104db030b5cc871c3a2977a8023ed7cee62b1.zip
ALSA: usb-audio: not submit urb for stopped endpoint
commit 528699317dd6dc722dccc11b68800cf945109390 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 <henryl@nvidia.com> Link: https://lore.kernel.org/r/20191113021420.13377-1-henryl@nvidia.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--sound/usb/endpoint.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 0f95338aa81d..94071f591833 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -377,6 +377,9 @@ static void snd_complete_urb(struct urb *urb)
}
prepare_outbound_urb(ep, ctx);
+ /* can be stopped during prepare callback */
+ if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
+ goto exit_clear;
} else {
retire_inbound_urb(ep, ctx);
/* can be stopped during retire callback */