From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Paul Olaru <paul.olaru@oss.nxp.com>,
Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
Cc: sound-open-firmware@alsa-project.org,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] ASoC: SOF: Don't allow pointer operations on unconfigured streams
Date: Fri, 27 Mar 2026 11:49:41 +0200 [thread overview]
Message-ID: <3cd96fe7-4575-40f9-a1f2-610fb1fac5c1@linux.intel.com> (raw)
In-Reply-To: <20260326-asoc-compress-tstamp-params-v1-1-3dc735b3d599@kernel.org>
On 26/03/2026 16:52, Mark Brown wrote:
> 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;
> +
Is this a theoretical fix?
I don't think this can happen in real world as set_params would need to
fail and if that failed then applications would not ask for a pointer as
the compress stream cannot be even started.
> 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>
>
>
--
Péter
next prev parent reply other threads:[~2026-03-27 9:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-26 14:52 [PATCH] ASoC: SOF: Don't allow pointer operations on unconfigured streams Mark Brown
2026-03-27 2:09 ` Liao, Bard
2026-03-27 16:48 ` Mark Brown
2026-03-30 2:32 ` Liao, Bard
2026-03-27 9:49 ` Péter Ujfalusi [this message]
2026-03-27 16:52 ` Mark Brown
2026-03-30 7:01 ` Péter Ujfalusi
2026-03-30 11:05 ` Mark Brown
2026-03-30 11:50 ` Péter Ujfalusi
2026-03-30 20:11 ` Mark Brown
2026-03-31 5:12 ` Péter Ujfalusi
2026-03-31 11:25 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3cd96fe7-4575-40f9-a1f2-610fb1fac5c1@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=laurentiu.mihalcea@nxp.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=paul.olaru@oss.nxp.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.