]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 Nov 2014 18:10:22 +0000 (10:10 -0800)
commit decc27b01d584c985c231e73d3b493de6ec07af8 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/soc-core.c

index d074aa91b023f8db8f7dace7f62db25a564517ce..a3e0a0df9c75b089c8695a7af6a6ca600acc14fe 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);