Re: [PATCH] ALSA: pcm: Apply sync-stop at SNDRV_PCM_IOCTL_DROP ioctl

From: Takashi Iwai

Date: Thu Oct 15 2026 - 16:10:00 EST


On Thu, 15 Oct 2026 20:30:21 +0200,
Marek Szyprowski wrote:
>
> On 14.10.2026 16:24, Takashi Iwai wrote:
> > When a PCM stream is stopped via SNDRV_PCM_IOCTL_DROP ioctl, it calls
> > snd_pcm_stop() but sync-stop operation is missing. Although this is
> > usually no big issue, let's add snd_pcm_sync_stop() call, just to be
> > sure.
> >
> > Signed-off-by: Takashi Iwai <tiwai@xxxxxxx>
> > ---
> > sound/core/pcm_native.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> > index 6c379068b54c..7ffbf2c0ea92 100644
> > --- a/sound/core/pcm_native.c
> > +++ b/sound/core/pcm_native.c
> > @@ -2332,6 +2332,8 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
> > result = snd_pcm_stop(substream, SNDRV_PCM_STATE_SETUP);
> > /* runtime->control->appl_ptr = runtime->status->hw_ptr; */
> >
> > + snd_pcm_sync_stop(substream, true);
> > +
> > return result;
> > }
>
> This patch landed in today's linux-next as commit fdf9a21cda78 ("ALSA: pcm: Apply
> sync-stop at SNDRV_PCM_IOCTL_DROP ioctl"). In my tests I found that it triggers
> the kernel bug about invalid context for sleeping.
>
> It looks that thissnd_pcm_sync_stop() should be called outside the scope of
> the guard(pcm_stream_lock_irq)(substream).

Gah, obviously it's calling in a wrong context, and I overlooked
guard() line.

I'm going to submit the trivial fix.


thanks,

Takashi