]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: soc-core: call snd_soc_unbind_card() under mutex_lock;
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 19 Jun 2019 01:07:19 +0000 (10:07 +0900)
committerMark Brown <broonie@kernel.org>
Mon, 24 Jun 2019 16:18:10 +0000 (17:18 +0100)
commitd7e20ecd3c6944a58deaa93b263c7da6e4cfb67e
tree8e32ce18e6c16626304af8baaef6b4e0b8fa60db
parent4579983b5c7184f80bb74a6b2522c2c4a52fcd67
ASoC: soc-core: call snd_soc_unbind_card() under mutex_lock;

commit 258b46779a574b9 ("ASoC: core: lock client_mutex while removing
link components") added mutex_lock() at soc_remove_link_components().

Is is called from snd_soc_unbind_card()

snd_soc_unbind_card()
=> soc_remove_link_components()
soc_cleanup_card_resources()
soc_remove_dai_links()
=> soc_remove_link_components()

And, there are 2 way to call it.

(1)
snd_soc_unregister_component()
** mutex_lock()
snd_soc_component_del_unlocked()
=> snd_soc_unbind_card()
** mutex_unlock()

(2)
snd_soc_unregister_card()
=> snd_soc_unbind_card()

(1) case is already using mutex_lock() when it calles
snd_soc_unbind_card(), thus, we will get lockdep warning.

commit a013480fd06d200 ("ASoC: core: Fix deadlock in
snd_soc_instantiate_card()") tried to fixup it, but still not
enough. We still have lockdep warning when we try unbind/bind.

We need mutex_lock() under snd_soc_unregister_card()
instead of snd_remove_link_components()/snd_soc_unbind_card().

Fixes: 258b46779a574b9 ("ASoC: core: lock client_mutex while removing link components")
Fixes: a013480fd06d200 ("ASoC: core: Fix deadlock in snd_soc_instantiate_card()")
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c