Re: [PATCH] ALSA: core: Serialize deferred fasync state checks
From: Takashi Iwai
Date: Wed May 06 2026 - 04:08:59 EST
On Wed, 06 May 2026 05:34:47 +0200,
Cássio Gabriel wrote:
>
> snd_fasync_helper() updates fasync->on under snd_fasync_lock, and
> snd_fasync_work_fn() now also evaluates fasync->on under the same
> lock. snd_kill_fasync() still tests the flag before taking the lock,
> leaving an unsynchronized read against FASYNC enable/disable updates.
>
> Move the enabled-state check into the locked section.
>
> Also clear fasync->on under snd_fasync_lock in snd_fasync_free()
> before unlinking the pending entry. Together with the locked sender-side
> check, this publishes teardown before flushing the deferred work and
> prevents a racing sender from requeueing the entry after free has
> started.
>
> Fixes: ef34a0ae7a26 ("ALSA: core: Add async signal helpers")
> Fixes: 8146cd333d23 ("ALSA: core: Fix potential data race at fasync handling")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@xxxxxxxxx>
Thanks, applied now.
Takashi