提交 4ed53a37 编写于 作者: T Takashi Iwai 提交者: Zheng Zengkai

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

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

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

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

[ Upstream commit 06764dc9 ]

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: 9058cbe1 ("ALSA: jack: implement kctl creating for jack devices")
Link: https://lore.kernel.org/r/20211116071314.15065-1-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>
上级 1beee911
...@@ -54,10 +54,13 @@ static int snd_jack_dev_free(struct snd_device *device) ...@@ -54,10 +54,13 @@ static int snd_jack_dev_free(struct snd_device *device)
struct snd_card *card = device->card; struct snd_card *card = device->card;
struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl; struct snd_jack_kctl *jack_kctl, *tmp_jack_kctl;
down_write(&card->controls_rwsem);
list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) { list_for_each_entry_safe(jack_kctl, tmp_jack_kctl, &jack->kctl_list, list) {
list_del_init(&jack_kctl->list); list_del_init(&jack_kctl->list);
snd_ctl_remove(card, jack_kctl->kctl); snd_ctl_remove(card, jack_kctl->kctl);
} }
up_write(&card->controls_rwsem);
if (jack->private_free) if (jack->private_free)
jack->private_free(jack); jack->private_free(jack);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册