Skip to content

Commit 1225675

Browse files
committed
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/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent c5ab94e commit 1225675

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

sound/core/pcm_native.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,8 @@ static int snd_pcm_pre_resume(struct snd_pcm_substream *substream,
17751775
snd_pcm_state_t state)
17761776
{
17771777
struct snd_pcm_runtime *runtime = substream->runtime;
1778+
if (runtime->state != SNDRV_PCM_STATE_SUSPENDED)
1779+
return -EBADFD;
17781780
if (!(runtime->info & SNDRV_PCM_INFO_RESUME))
17791781
return -ENOSYS;
17801782
runtime->trigger_master = substream;

0 commit comments

Comments
 (0)