提交 4072aa6a 编写于 作者: T Takashi Iwai 提交者: Zheng Zengkai

ALSA: PCM: Add missing rwsem around snd_ctl_remove() calls

stable inclusion
from stable-v5.10.94
commit 180e9d7384c6ba2467452d2dc9e83263c97ab13b
bugzilla: https://gitee.com/openeuler/kernel/issues/I531X9

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=180e9d7384c6ba2467452d2dc9e83263c97ab13b

--------------------------------

[ Upstream commit 5471e976 ]

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: a8ff48cb ("ALSA: pcm: Free chmap at PCM free callback, too")
Link: https://lore.kernel.org/r/20211116071314.15065-2-tiwai@suse.deSigned-off-by: NTakashi Iwai <tiwai@suse.de>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 4ed53a37
...@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal); ...@@ -810,7 +810,11 @@ EXPORT_SYMBOL(snd_pcm_new_internal);
static void free_chmap(struct snd_pcm_str *pstr) static void free_chmap(struct snd_pcm_str *pstr)
{ {
if (pstr->chmap_kctl) { if (pstr->chmap_kctl) {
snd_ctl_remove(pstr->pcm->card, pstr->chmap_kctl); struct snd_card *card = pstr->pcm->card;
down_write(&card->controls_rwsem);
snd_ctl_remove(card, pstr->chmap_kctl);
up_write(&card->controls_rwsem);
pstr->chmap_kctl = NULL; pstr->chmap_kctl = NULL;
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册