Skip to contentSkip to conversation

ALSA: PCM: Allow resume only for suspended streams

PATCH New Takashi Iwai 1 participant 1 message Jun 24, 2024 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 sound/core/pcm_native.c | 2 ++
 1 file changed, 2 insertions(+)
sound/core/pcm_native.c +2 -0
index 521ba56392a0..c152ccf32214 100644
@@ -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;
Signature · 1 line
2.43.0