ALSA: fireworks: change the range of critical section for stream data in PCM.hw_free...
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sat, 15 Jun 2019 09:11:00 +0000 (18:11 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 17 Jun 2019 06:18:36 +0000 (08:18 +0200)
The operation of duplex streams should be in critical section.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/fireworks/fireworks_pcm.c

index 287fc05d59179e44c9352a1741dca6ce78aff5e6..8dc34249a1b0481c43583c399039de7babdd69b7 100644 (file)
@@ -247,14 +247,15 @@ static int pcm_hw_free(struct snd_pcm_substream *substream)
 {
        struct snd_efw *efw = substream->private_data;
 
-       if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN) {
-               mutex_lock(&efw->mutex);
+       mutex_lock(&efw->mutex);
+
+       if (substream->runtime->status->state != SNDRV_PCM_STATE_OPEN)
                --efw->substreams_counter;
-               mutex_unlock(&efw->mutex);
-       }
 
        snd_efw_stream_stop_duplex(efw);
 
+       mutex_unlock(&efw->mutex);
+
        return snd_pcm_lib_free_vmalloc_buffer(substream);
 }