Skip to content

Commit de7e30d

Browse files
tiwaigregkh
authored andcommitted
ALSA: pcm: Don't call sync_stop if it hasn't been stopped
commit 700cb70 upstream. The PCM stop operation sets the stop_operating flag for indicating the sync_stop post-process. This flag is, however, set unconditionally even if the PCM trigger weren't issued. This may lead to inconsistency in the driver side. Correct the code to set stop_operating flag only after the trigger STOP is actually called. Fixes: 1e850be ("ALSA: pcm: Add the support for sync-stop operation") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210206203656.15959-4-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 7011cd4 commit de7e30d

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎sound/core/pcm_native.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,8 +1421,10 @@ static int snd_pcm_do_stop(struct snd_pcm_substream *substream,
14211421
snd_pcm_state_t state)
14221422
{
14231423
if (substream->runtime->trigger_master == substream &&
1424-
snd_pcm_running(substream))
1424+
snd_pcm_running(substream)) {
14251425
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
1426+
substream->runtime->stop_operating = true;
1427+
}
14261428
return 0; /* unconditonally stop all substreams */
14271429
}
14281430

@@ -1435,7 +1437,6 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream,
14351437
runtime->status->state = state;
14361438
snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTOP);
14371439
}
1438-
runtime->stop_operating = true;
14391440
wake_up(&runtime->sleep);
14401441
wake_up(&runtime->tsleep);
14411442
}

0 commit comments

Comments
 (0)