--- zzzz-none-000/linux-5.4.213/sound/core/pcm.c 2022-09-15 10:04:56.000000000 +0000 +++ miami-7690-761/linux-5.4.213/sound/core/pcm.c 2024-05-29 11:20:02.000000000 +0000 @@ -692,6 +692,9 @@ } substream->group = &substream->self_group; snd_pcm_group_init(&substream->self_group); +#ifdef CONFIG_AUDIO_QGKI + spin_lock_init(&substream->runtime_lock); +#endif list_add_tail(&substream->link_list, &substream->self_group.substreams); atomic_set(&substream->mmap_count, 0); prev = substream; @@ -985,9 +988,15 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) { struct snd_pcm_runtime *runtime; +#ifdef CONFIG_AUDIO_QGKI + unsigned long flags = 0; +#endif if (PCM_RUNTIME_CHECK(substream)) return; +#ifdef CONFIG_AUDIO_QGKI + spin_lock_irqsave(&substream->runtime_lock, flags); +#endif runtime = substream->runtime; if (runtime->private_free != NULL) runtime->private_free(runtime); @@ -1007,6 +1016,9 @@ put_pid(substream->pid); substream->pid = NULL; substream->pstr->substream_opened--; +#ifdef CONFIG_AUDIO_QGKI + spin_unlock_irqrestore(&substream->runtime_lock, flags); +#endif } static ssize_t show_pcm_class(struct device *dev,