Skip to content

Commit 0f0c0c1

Browse files
brooniegregkh
authored andcommitted
ASoC: SOF: Don't allow pointer operations on unconfigured streams
commit c5b6285 upstream. 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: c1a731c ("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 <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9a2d03d commit 0f0c0c1

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

sound/soc/sof/compress.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ static int sof_compr_pointer(struct snd_soc_component *component,
371371
if (!spcm)
372372
return -EINVAL;
373373

374+
if (!sstream->channels || !sstream->sample_container_bytes)
375+
return -EBUSY;
376+
374377
tstamp->sampling_rate = sstream->sampling_rate;
375378
tstamp->copied_total = sstream->copied_total;
376379
tstamp->pcm_io_frames = div_u64(spcm->stream[cstream->direction].posn.dai_posn,

0 commit comments

Comments
 (0)