From: Mark Brown Date: Thu, 26 Mar 2026 14:52:41 +0000 (+0000) Subject: ASoC: SOF: Don't allow pointer operations on unconfigured streams X-Git-Url: http://git.ipfire.org/index.cgi?a=commitdiff_plain;h=c5b6285aae050ff1c3ea824ca3d88ac4be1e69c8;p=thirdparty%2Fkernel%2Flinux.git ASoC: SOF: Don't allow pointer operations on unconfigured streams 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") Cc: stable@vger.kernel.org Link: https://patch.msgid.link/20260326-asoc-compress-tstamp-params-v1-1-3dc735b3d599@kernel.org Signed-off-by: Mark Brown --- diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index f4c3e10e6344d..93f2376585dbf 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -381,6 +381,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,