ASoC: Intel: avs: Lock substream before snd_pcm_stop()
authorCezary Rojewski <cezary.rojewski@intel.com>
Wed, 16 Nov 2022 11:55:49 +0000 (12:55 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 22 Nov 2022 19:32:26 +0000 (19:32 +0000)
snd_pcm_stop() shall be called with stream lock held to prevent any
races between nonatomic streaming operations.

Fixes: 2f1f570cd730 ("ASoC: Intel: avs: Coredump and recovery flow")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20221116115550.1100398-2-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/ipc.c

index 152f8d0bdf8eac5e45b7d1944788e265bfeb0b10..af8a260093f4c67cc483594126be2260fccb0133 100644 (file)
@@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev)
                                if (!substream || !substream->runtime)
                                        continue;
 
+                               /* No need for _irq() as we are in nonatomic context. */
+                               snd_pcm_stream_lock(substream);
                                snd_pcm_stop(substream, SNDRV_PCM_STATE_DISCONNECTED);
+                               snd_pcm_stream_unlock(substream);
                        }
                }
        }