Commit 1225675c authored by Takashi Iwai's avatar Takashi Iwai

ALSA: PCM: Allow resume only for suspended streams

snd_pcm_resume() should bail out if the stream isn't in a suspended
state.  Otherwise it'd allow doubly resume.

Link: https://patch.msgid.link/20240624125443.27808-1-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c5ab94ea
...@@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, ...@@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream,
snd_pcm_state_t state) snd_pcm_state_t state)
{ {
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
if (runtime->state != SNDRV_PCM_STATE_SUSPENDED)
return -EBADFD;
if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
return -ENOSYS; return -ENOSYS;
runtime->trigger_master = substream; runtime->trigger_master = substream;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment