ASoC: core: lock client_mutex while removing link components [Linux 5.2]

ASoC: core: lock client_mutex while removing link components [Linux 5.2]

This Linux kernel change "ASoC: core: lock client_mutex while removing link components" is included in the Linux 5.2 release. This change is authored by Ranjani Sridharan <ranjani.sridharan [at] linux.intel.com> on Thu May 23 10:12:01 2019 -0700. The commit for this change in Linux stable tree is 34ac3c3 (patch).

ASoC: core: lock client_mutex while removing link components

Removing link components results in topology unloading. So,
acquire the client_mutex before removing components in
soc_remove_link_components. This will prevent the lockdep warning
seen when dai links are removed during topology removal.

Signed-off-by: Ranjani Sridharan <[email protected]inux.intel.com>
Signed-off-by: Mark Brown <[email protected]>

There are 2 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 sound/soc/soc-core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 2403bec..7c94159 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1005,12 +1005,14 @@ static void soc_remove_link_components(struct snd_soc_card *card,
    struct snd_soc_component *component;
    struct snd_soc_rtdcom_list *rtdcom;

+   mutex_lock(&client_mutex);
    for_each_rtdcom(rtd, rtdcom) {
        component = rtdcom->component;

        if (component->driver->remove_order == order)
            soc_remove_component(component);
    }
+   mutex_unlock(&client_mutex);
 }

 static void soc_remove_dai_links(struct snd_soc_card *card)

Leave a Reply

Your email address will not be published. Required fields are marked *