aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2025-02-06 16:16:38 +0000
committerMark Brown <broonie@kernel.org>2025-02-06 16:16:38 +0000
commit199b87f1409b936cc23a8ba2d66a1ce962db7f0f (patch)
tree2f9f41a8600094e6c6fb955d7265fc0dda1d6aee
parentASoC: rsnd: adjust convert rate in 1% (diff)
parentASoC: SOF: pcm: Clear the susbstream pointer to NULL on close (diff)
downloadwireguard-linux-199b87f1409b936cc23a8ba2d66a1ce962db7f0f.tar.xz
wireguard-linux-199b87f1409b936cc23a8ba2d66a1ce962db7f0f.zip
ASoC: SOF: Correct sps->stream and cstream nullity
Merge series from Peter Ujfalusi <peter.ujfalusi@linux.intel.com>: The Nullity of sps->cstream needs to be checked in sof_ipc_msg_data() and not assume that it is not NULL. The sps->stream must be cleared to NULL on close since this is used as a check to see if we have active PCM stream.
Diffstat (limited to '')
-rw-r--r--sound/soc/sof/pcm.c2
-rw-r--r--sound/soc/sof/stream-ipc.c6
2 files changed, 7 insertions, 1 deletions
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 35a7462d8b69..c5c6353f18ce 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -511,6 +511,8 @@ static int sof_pcm_close(struct snd_soc_component *component,
*/
}
+ spcm->stream[substream->stream].substream = NULL;
+
return 0;
}
diff --git a/sound/soc/sof/stream-ipc.c b/sound/soc/sof/stream-ipc.c
index 794c7bbccbaf..8262443ac89a 100644
--- a/sound/soc/sof/stream-ipc.c
+++ b/sound/soc/sof/stream-ipc.c
@@ -43,7 +43,7 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
return -ESTRPIPE;
posn_offset = stream->posn_offset;
- } else {
+ } else if (sps->cstream) {
struct sof_compr_stream *sstream = sps->cstream->runtime->private_data;
@@ -51,6 +51,10 @@ int sof_ipc_msg_data(struct snd_sof_dev *sdev,
return -ESTRPIPE;
posn_offset = sstream->posn_offset;
+
+ } else {
+ dev_err(sdev->dev, "%s: No stream opened\n", __func__);
+ return -EINVAL;
}
snd_sof_dsp_mailbox_read(sdev, posn_offset, p, sz);