Skip to content

Commit 5471e97

Browse files
committed
ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls
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: a8ff48c ("ALSA: pcm: Free chmap at PCM free callback, too") Link: https://lore.kernel.org/r/20211116071314.15065-2-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 06764dc commit 5471e97

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

sound/core/pcm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal);
810810
static void free_chmap(struct snd_pcm_str *pstr)
811811
{
812812
if (pstr->chmap_kctl) {
813-
snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl);
813+
struct snd_card *card = pstr->pcm->card;
814+
815+
down_write(&card->controls_rwsem);
816+
snd_ctl_remove(card, pstr->chmap_kctl);
817+
up_write(&card->controls_rwsem);
814818
pstr->chmap_kctl = NULL;
815819
}
816820
}

0 commit comments

Comments
 (0)