diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-04-30 13:45:50 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-05-03 13:43:52 -0400 |
commit | 6c45e126567eb9f96519ca97917ce317fcbe5218 (patch) | |
tree | a7f5b8ee37c37ba40ae4c959d3098a7146a81ada /sound/soc/soc-dapm.c | |
parent | d5d1e0bef4385a0cd726613c0fc1909cd23efd39 (diff) |
ASoC: Remove DAPM debugfs entries before freeing widgets
Remove the DAPM debugfs entries before freeing the context's widgets, otherwise a
use after free situation might occur.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 8454cc2967d6..169e1767ebd0 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1292,6 +1292,11 @@ static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) | |||
1292 | w->name); | 1292 | w->name); |
1293 | } | 1293 | } |
1294 | 1294 | ||
1295 | static void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) | ||
1296 | { | ||
1297 | debugfs_remove_recursive(dapm->debugfs_dapm); | ||
1298 | } | ||
1299 | |||
1295 | #else | 1300 | #else |
1296 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | 1301 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, |
1297 | struct dentry *parent) | 1302 | struct dentry *parent) |
@@ -1302,6 +1307,10 @@ static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) | |||
1302 | { | 1307 | { |
1303 | } | 1308 | } |
1304 | 1309 | ||
1310 | static inline void dapm_debugfs_cleanup(struct snd_soc_dapm_context *dapm) | ||
1311 | { | ||
1312 | } | ||
1313 | |||
1305 | #endif | 1314 | #endif |
1306 | 1315 | ||
1307 | /* test and update the power status of a mux widget */ | 1316 | /* test and update the power status of a mux widget */ |
@@ -2445,6 +2454,7 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); | |||
2445 | void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm) | 2454 | void snd_soc_dapm_free(struct snd_soc_dapm_context *dapm) |
2446 | { | 2455 | { |
2447 | snd_soc_dapm_sys_remove(dapm->dev); | 2456 | snd_soc_dapm_sys_remove(dapm->dev); |
2457 | dapm_debugfs_cleanup(dapm); | ||
2448 | dapm_free_widgets(dapm); | 2458 | dapm_free_widgets(dapm); |
2449 | list_del(&dapm->list); | 2459 | list_del(&dapm->list); |
2450 | } | 2460 | } |