diff options
| author | Ziyi Guo <n7l8m4@u.northwestern.edu> | 2026-02-02 17:41:12 +0000 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-02-19 16:28:25 +0100 |
| commit | 61e007657bf7740d54ca2aadce0fb5997839818e (patch) | |
| tree | ec680125efe70cfe16dc3c21f9e1220e976ccb85 | |
| parent | f49d2497da140a4dbb7d6373264553ea04b37691 (diff) | |
| download | linux-61e007657bf7740d54ca2aadce0fb5997839818e.tar.gz linux-61e007657bf7740d54ca2aadce0fb5997839818e.tar.bz2 linux-61e007657bf7740d54ca2aadce0fb5997839818e.zip | |
ASoC: fsl_xcvr: fix missing lock in fsl_xcvr_mode_put()
[ Upstream commit f514248727606b9087bc38a284ff686e0093abf1 ]
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>
Link: https://patch.msgid.link/20260202174112.2018402-1-n7l8m4@u.northwestern.edu
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
| -rw-r--r-- | sound/soc/fsl/fsl_xcvr.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/fsl/fsl_xcvr.c b/sound/soc/fsl/fsl_xcvr.c index 90a0a24c05d8..3a5ab8b53672 100644 --- a/sound/soc/fsl/fsl_xcvr.c +++ b/sound/soc/fsl/fsl_xcvr.c @@ -206,10 +206,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); 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 = |
