* [PATCH] ASoC: SOF: Don't allow pointer operations on unconfigured streams
@ 2026-03-26 14:52 Mark Brown
0 siblings, 0 replies; only message in thread
From: Mark Brown @ 2026-03-26 14:52 UTC (permalink / raw)
To: Liam Girdwood, Peter Ujfalusi, Bard Liao, Ranjani Sridharan,
Daniel Baluta, Kai Vehmanen, Pierre-Louis Bossart,
Jaroslav Kysela, Takashi Iwai, Paul Olaru, Laurentiu Mihalcea
Cc: sound-open-firmware, linux-sound, linux-kernel, Mark Brown,
stable
When reporting the pointer for a compressed stream we report the current
I/O frame position by dividing the position by the number of channels
multiplied by the number of container bytes. These values default to 0 and
are only configured as part of setting the stream parameters so this allows
a divide by zero to be configured. Validate that they are non zero,
returning an error if not
Fixes: c1a731c71359 ("ASoC: SOF: compress: Add support for computing timestamps")
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
---
sound/soc/sof/compress.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c
index 96570121aae0..90f056eae1c3 100644
--- a/sound/soc/sof/compress.c
+++ b/sound/soc/sof/compress.c
@@ -379,6 +379,9 @@ static int sof_compr_pointer(struct snd_soc_component *component,
if (!spcm)
return -EINVAL;
+ if (!sstream->channels || !sstream->sample_container_bytes)
+ return -EBUSY;
+
tstamp->sampling_rate = sstream->sampling_rate;
tstamp->copied_total = sstream->copied_total;
tstamp->pcm_io_frames = div_u64(spcm->stream[cstream->direction].posn.dai_posn,
---
base-commit: c369299895a591d96745d6492d4888259b004a9e
change-id: 20260326-asoc-compress-tstamp-params-296f38f15217
Best regards,
--
Mark Brown <broonie@kernel.org>
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-26 14:53 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-26 14:52 [PATCH] ASoC: SOF: Don't allow pointer operations on unconfigured streams Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox