@@ -980,8 +980,12 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
{
struct snd_pcm_runtime *runtime;
- if (PCM_RUNTIME_CHECK(substream))
+ if (snd_BUG_ON(!substream))
return;
+
+ snd_pcm_stream_lock_irq(substream);
+ if (PCM_RUNTIME_CHECK(substream))
+ goto unlock;
runtime = substream->runtime;
if (runtime->private_free != NULL)
runtime->private_free(runtime);
@@ -1000,6 +1004,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
put_pid(substream->pid);
substream->pid = NULL;
substream->pstr->substream_opened--;
+ unlock:
+ snd_pcm_stream_unlock_irq(substream);
}
static ssize_t show_pcm_class(struct device *dev,
Since snd_pcm_detach_substream modifies the input substream, the function should use stream lock to protect the modification section. Signed-off-by: paulhsia <paulhsia@chromium.org> --- sound/core/pcm.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)