summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorThomas Hebb <tommyhebb@gmail.com>2020-12-12 17:20:12 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-01-23 15:38:16 +0100
commitc7036ddd0e01bb295e445e25433beb27ed25d9a4 (patch)
tree6ad71907faf177ae22fa3ac45f074b61a79ed718 /sound
parent10161a5e7a07212efa9152f31611570ba95b3b24 (diff)
downloadlinux-stable-c7036ddd0e01bb295e445e25433beb27ed25d9a4.tar.gz
linux-stable-c7036ddd0e01bb295e445e25433beb27ed25d9a4.tar.bz2
linux-stable-c7036ddd0e01bb295e445e25433beb27ed25d9a4.zip
ASoC: dapm: remove widget from dirty list on free
commit 5c6679b5cb120f07652418524ab186ac47680b49 upstream. A widget's "dirty" list_head, much like its "list" list_head, eventually chains back to a list_head on the snd_soc_card itself. This means that the list can stick around even after the widget (or all widgets) have been freed. Currently, however, widgets that are in the dirty list when freed remain there, corrupting the entire list and leading to memory errors and undefined behavior when the list is next accessed or modified. I encountered this issue when a component failed to probe relatively late in snd_soc_bind_card(), causing it to bail out and call soc_cleanup_card_resources(), which eventually called snd_soc_dapm_free() with widgets that were still dirty from when they'd been added. Fixes: db432b414e20 ("ASoC: Do DAPM power checks only for widgets changed since last run") Cc: stable@vger.kernel.org Signed-off-by: Thomas Hebb <tommyhebb@gmail.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/f8b5f031d50122bf1a9bfc9cae046badf4a7a31a.1607822410.git.tommyhebb@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-dapm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 41a29bb21519..11edb6f6bdaf 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2349,6 +2349,7 @@ void snd_soc_dapm_free_widget(struct snd_soc_dapm_widget *w)
enum snd_soc_dapm_direction dir;
list_del(&w->list);
+ list_del(&w->dirty);
/*
* remove source and sink paths associated to this widget.
* While removing the path, remove reference to it from both