Hi,

Am Montag, 2. Februar 2026, 18:41:12 CET schrieb Ziyi Guo:
> fsl_xcvr_activate_ctl() has 
> lockdep_assert_held(&card->snd_card->controls_rwsem),
> but fsl_xcvr_mode_put() calls it without acquiring this lock.
> 
> Other callers of fsl_xcvr_activate_ctl() in fsl_xcvr_startup() and
> fsl_xcvr_shutdown() properly acquire the lock with down_read()/up_read().
> 
> Add the missing down_read()/up_read() calls around fsl_xcvr_activate_ctl()
> in fsl_xcvr_mode_put() to fix the lockdep assertion and prevent potential
> race conditions when multiple userspace threads access the control.
> 
> Signed-off-by: Ziyi Guo <[email protected]>
> ---
>  sound/soc/fsl/fsl_xcvr.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c
> index a268fb81a2f8..0b9dd64b9a82 100644
> --- a/sound/soc/fsl/fsl_xcvr.c
> +++ b/sound/soc/fsl/fsl_xcvr.c
> @@ -223,10 +223,13 @@ static int fsl_xcvr_mode_put(struct snd_kcontrol 
> *kcontrol,
>  
>       xcvr->mode = snd_soc_enum_item_to_val(e, item[0]);
>  
> +     down_read(&card->snd_card->controls_rwsem);

This lock causes a blocked task on my TQMa8MPxL based board:

INFO: task alsactl:1969 blocked for more than 120 seconds.
      Tainted: G        W           6.19.0-next-20260209+ #3331
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
task:alsactl         state:D stack:0     pid:1969  tgid:1969  ppid:1      
task_flags:0x400100 flags:0x00000a01
Call trace:
 __switch_to+0xdc/0x120 (T)
 __schedule+0x258/0x790
 schedule+0x30/0xb0
 schedule_preempt_disabled+0x20/0x40
 rwsem_down_read_slowpath+0x214/0x68c
 down_read+0xb0/0xb8
 fsl_xcvr_mode_put+0x4c/0xc0 [snd_soc_fsl_xcvr 
ac1b31380c6a6ea0d613bd5f78489e314a40f91f]
 snd_ctl_elem_write+0xdc/0x180 [snd 852e63996474051c57bcd1a86ebfd81083073853]
 snd_ctl_ioctl+0x7a4/0xaec [snd 852e63996474051c57bcd1a86ebfd81083073853]
 __arm64_sys_ioctl+0x9c/0xe4
 invoke_syscall.constprop.0+0x58/0xcc
 el0_svc_common.constprop.0+0xac/0xd4
 do_el0_svc+0x18/0x20
 el0_svc+0x24/0xa0
 el0t_64_sync_handler+0x98/0xdc
 el0t_64_sync+0x154/0x158
INFO: task alsactl:1969 <reader> blocked on an rw-semaphore likely owned by 
task alsactl:1969 <writer>

Best regards,
Alexander

>       fsl_xcvr_activate_ctl(dai, fsl_xcvr_arc_mode_kctl.name,
>                             (xcvr->mode == FSL_XCVR_MODE_ARC));
>       fsl_xcvr_activate_ctl(dai, fsl_xcvr_earc_capds_kctl.name,
>                             (xcvr->mode == FSL_XCVR_MODE_EARC));
> +     up_read(&card->snd_card->controls_rwsem);
> +
>       /* Allow playback for SPDIF only */
>       rtd = snd_soc_get_pcm_runtime(card, card->dai_link);
>       rtd->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream_count =
> 


-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
http://www.tq-group.com/



Reply via email to