]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: core: fix use after free in snd_soc_remove_platform()
authorDaniel Mack <daniel@zonque.org>
Tue, 7 Oct 2014 11:41:23 +0000 (13:41 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 7 Oct 2014 12:12:28 +0000 (13:12 +0100)
Coverity spotted an use-after-free condition in snd_soc_remove_platform().
Fix this by moving snd_soc_component_cleanup() after the debug print
statement which uses the component's string.

Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
sound/soc/soc-core.c

index ae48f1013e8093bbf359a831ae8e48e837a6dfa1..d877ec57d76151938544ba1744b690b5d0096a5f 100644 (file)
@@ -4315,10 +4315,10 @@ void snd_soc_remove_platform(struct snd_soc_platform *platform)
        snd_soc_component_del_unlocked(&platform->component);
        mutex_unlock(&client_mutex);
 
-       snd_soc_component_cleanup(&platform->component);
-
        dev_dbg(platform->dev, "ASoC: Unregistered platform '%s'\n",
                platform->component.name);
+
+       snd_soc_component_cleanup(&platform->component);
 }
 EXPORT_SYMBOL_GPL(snd_soc_remove_platform);