On Thu, 10 Jun 2021 22:53:26 +0200, Pierre-Louis Bossart wrote: > > +/* update SPIB register with appl position */ > +int hda_dsp_pcm_ack(struct snd_sof_dev *sdev, struct snd_pcm_substream *substream) > +{ > + struct hdac_stream *hstream = substream->runtime->private_data; > + struct hdac_ext_stream *stream = stream_to_hdac_ext_stream(hstream); > + struct snd_pcm_runtime *runtime = substream->runtime; > + ssize_t appl_pos, buf_size; > + u32 spib; > + > + if (!hda_disable_rewinds) > + return 0; > + > + /* > + * paranoia check: if a rewind request took place after the RUN bits were programmed, > + * deny it since hardware only supports monotonic (modulo) increments for SPIB. > + */ > + if (hstream->running) { > + if (runtime->control->appl_ptr < stream->old_appl_ptr) > + return -EINVAL; This condition won't be enough when the appl_ptr overlap the buffer boundary. It's still possible on 32bit architecture. thanks, Takashi