Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4421a196 authored by Takashi Iwai's avatar Takashi Iwai Committed by Greg Kroah-Hartman
Browse files

ASoC: topology: Add missing rwsem around snd_ctl_remove() calls



[ Upstream commit 7e567b5ae06315ef2d70666b149962e2bb4b97af ]

snd_ctl_remove() has to be called with card->controls_rwsem held (when
called after the card instantiation).  This patch add the missing
rwsem calls around it.

Fixes: 8a978234 ("ASoC: topology: Add topology core")
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20211116071812.18109-1-tiwai@suse.de


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 76867d0c
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2777,6 +2777,7 @@ EXPORT_SYMBOL_GPL(snd_soc_tplg_widget_remove_all);
/* remove dynamic controls from the component driver */
int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
{
	struct snd_card *card = comp->card->snd_card;
	struct snd_soc_dobj *dobj, *next_dobj;
	int pass = SOC_TPLG_PASS_END;

@@ -2784,6 +2785,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
	while (pass >= SOC_TPLG_PASS_START) {

		/* remove mixer controls */
		down_write(&card->controls_rwsem);
		list_for_each_entry_safe(dobj, next_dobj, &comp->dobj_list,
			list) {

@@ -2827,6 +2829,7 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index)
				break;
			}
		}
		up_write(&card->controls_rwsem);
		pass--;
	}