Re: [PATCH] ALSA: control_led: Fix deadlock between sysfs writes and card disconnect

From: Takashi Iwai

Date: Mon Oct 12 2026 - 11:04:33 EST


On Mon, 12 Oct 2026 16:12:35 +0200,
Ali Ahmet Memiş wrote:
>
> On Mon, 12 Oct 2026 09:24:26 +0200, Takashi Iwai wrote:
> > Hm, it's not clear to me how this happens: I see no controls_rwsem
> > down around snd_ctl_led_disconnect() call. Could you elaborate about
> > it a bit more?
>
> It's taken in the call_snd_ctl_lops() macro in control.c:
>
> guard(rwsem_read)(&(_card)->controls_rwsem);
> guard(rwsem_read)(&snd_ctl_layer_rwsem);
>
> so snd_ctl_dev_disconnect() calls ->ldisconnect() with controls_rwsem
> held for read. snd_ctl_led_sysfs_remove() then waits in kernfs_drain()
> for the attach write which is blocked on down_write(controls_rwsem) in
> snd_ctl_led_set_id().

Thanks, now it's clearer.
The patch is applied to for-next branch now.


thanks,

Takashi