Re: [PATCH] ASoC: SOF: Don't allow pointer operations on unconfigured streams

From: Péter Ujfalusi

Date: Tue Mar 31 2026 - 01:12:47 EST




On 30/03/2026 23:11, Mark Brown wrote:
> On Mon, Mar 30, 2026 at 02:50:15PM +0300, Péter Ujfalusi wrote:
>> On 30/03/2026 14:05, Mark Brown wrote:
>
>>> We don't generally guard calls based on the state the stream is in,
>
>> compress does this quite much, just avail and tstamp is exempt for some
>> reason.
>
> Actually already we have a guard preventing userspace from doing an
> avail() when we're unconfigured but we do it after we've called down
> into the driver which is less than ideal. I think that's because we
> also check for XRUN and the availability check might cause us to notice
> that we're in a bad state for that.

I don't see how the avail path checks for XRUN and if the drivers
supposed to do that, I'm not even sure if XRUN is possible with compress..

I did noted that the avail have the state check reversed, making it
ineffective.

The other point is that any return code from the driver's pointer
callback is ignored by the core, the return value of
stream->ops->pointer() is not even captured, it could be void.
Looks like a design choice, but I cannot say.

fwiw, the same check should be added to sound/soc/qcom/qdsp6/q6apm-dai.c
as it does div with prtd->pcm_size (q6apm_dai_compr_pointer), which is
only initialized in set_params.

--
Péter