From: Alexander Stein <alexander.stein@ew.tq-group.com>
To: Shengjiu Wang <shengjiu.wang@gmail.com>,
Xiubo Li <Xiubo.Lee@gmail.com>,
Ziyi Guo <n7l8m4@u.northwestern.edu>
Cc: Fabio Estevam <festevam@gmail.com>,
Nicolin Chen <nicoleotsuka@gmail.com>,
Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org,
Ziyi Guo <n7l8m4@u.northwestern.edu>
Subject: Re: [PATCH] ASoC: fsl_xcvr: fix missing lock in fsl_xcvr_mode_put()
Date: Tue, 10 Feb 2026 08:18:26 +0100 [thread overview]
Message-ID: <5056506.GXAFRqVoOG@steina-w> (raw)
In-Reply-To: <20260202174112.2018402-1-n7l8m4@u.northwestern.edu>
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 <n7l8m4@u.northwestern.edu>
> ---
> 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/
next prev parent reply other threads:[~2026-02-10 7:20 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-02 17:41 [PATCH] ASoC: fsl_xcvr: fix missing lock in fsl_xcvr_mode_put() Ziyi Guo
2026-02-04 13:03 ` Mark Brown
2026-02-10 7:18 ` Alexander Stein [this message]
2026-02-10 13:55 ` Ziyi Guo
2026-02-10 13:57 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5056506.GXAFRqVoOG@steina-w \
--to=alexander.stein@ew.tq-group.com \
--cc=Xiubo.Lee@gmail.com \
--cc=broonie@kernel.org \
--cc=festevam@gmail.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=n7l8m4@u.northwestern.edu \
--cc=nicoleotsuka@gmail.com \
--cc=perex@perex.cz \
--cc=shengjiu.wang@gmail.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox