[12/49] firewire-lib: Restrict calling flush_context_completion() when context exists
diff mbox

Message ID 1398433530-13136-13-git-send-email-o-takashi@sakamocchi.jp
State Accepted
Delegated to: Takashi Iwai
Headers show

Commit Message

Takashi Sakamoto April 25, 2014, 1:44 p.m. UTC
Currently, drivers can bring XRUN state for PCM substreams when error to
queue packets or detecting discontinuity of packet. The application may try to
recover this state by calling snd_pcm_prepare().

Depending on each driver, .prepare() includes restart streaming. Then there
is a state that PCM substreams are running but isochronous contexts are
stopped. In this case, when .pointer() is called, it refers to error pointer.

This commit is for a prevention of this bug.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
 sound/firewire/amdtp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff mbox

diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index ac8c358..7c814ace 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -898,7 +898,7 @@  EXPORT_SYMBOL(amdtp_stream_start);
 unsigned long amdtp_stream_pcm_pointer(struct amdtp_stream *s)
 	/* this optimization is allowed to be racy */
-	if (s->pointer_flush)
+	if (s->pointer_flush && amdtp_stream_running(s))
 		s->pointer_flush = true;