Re: [PATCH v33 05/18] ALSA: pcm: serialize linked buffer actions

From: Takashi Iwai

Date: Wed Dec 02 2026 - 07:09:17 EST


On Fri, 13 Nov 2026 10:21:29 +0100,
Joonho Lee via B4 Relay wrote:
>
> From: Joonho Lee <mynameisjune111@xxxxxxxxx>
>
> Concurrent non-atomic actions on different members of a linked PCM group
> currently lock their own buffer first, then the other members. That
> acquisition order can differ between callers. Sibling buffer mutexes
> also do not close their buffer-access admission counters.
>
> Close buffer access for every member before taking any buffer mutex, and
> acquire those mutexes in the stable linked-list order while group
> membership is protected. Release every access gate on success and on
> failure, including when a member already has an active buffer access.
> The group action then uses the buffers already held by its caller.
>
> The PCM stream and group locks are not held across sleeping driver
> prepare callbacks. Single-stream non-atomic actions keep their existing
> buffer-access locking path.
>
> Fixes: 3c3201f8c7bb ("ALSA: pcm: Fix races among concurrent prepare and hw_params/hw_free calls")
> Fixes: bc55cfd5718c ("ALSA: pcm: Fix potential AB/BA lock with buffer_mutex and mmap_lock")
> Assisted-by: LLM
> Signed-off-by: Joonho Lee <mynameisjune111@xxxxxxxxx>

The linked stream actions have been changed recently.
So please revisit.


thanks,

Takashi