diff mbox

[1/3] ASoC: core: fix use after free in snd_soc_remove_platform()

Message ID 1412682085-5217-2-git-send-email-daniel@zonque.org (mailing list archive)
State Accepted
Commit decc27b01d584c985c231e73d3b493de6ec07af8
Headers show

Commit Message

Daniel Mack Oct. 7, 2014, 11:41 a.m. UTC
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>
---
 sound/soc/soc-core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown Oct. 7, 2014, 12:12 p.m. UTC | #1
On Tue, Oct 07, 2014 at 01:41:23PM +0200, Daniel Mack wrote:
> 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.

Applied, thanks.
diff mbox

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 3d8cff6..4c8f8a2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4192,10 +4192,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);