diff options
author | Takashi Iwai <tiwai@suse.de> | 2024-06-24 14:54:34 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2024-06-25 11:53:35 +0200 |
commit | 1225675ca74c746f09211528588e83b3def1ff6a (patch) | |
tree | 02949a72980f7c24b1eea477a49a85ecbf5ca252 /sound | |
parent | c5ab94ea280a9b4108723eecf0a636e22a5bb137 (diff) |
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.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/pcm_native.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 521ba56392a0..c152ccf32214 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream, snd_pcm_state_t state) { struct snd_pcm_runtime *runtime = substream->runtime; + if (runtime->state != SNDRV_PCM_STATE_SUSPENDED) + return -EBADFD; if (!(runtime->info & SNDRV_PCM_INFO_RESUME)) return -ENOSYS; runtime->trigger_master = substream; |