summaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorCurtis Malainey <cujomalainey@chromium.org>2019-01-10 16:21:04 -0800
committerMark Brown <broonie@kernel.org>2019-01-14 22:48:16 +0000
commit09ac6a817bd687e7f5dac00470262efdd72f9319 (patch)
tree654dca904bfc7902802b06b64fa40030747fce82 /include/sound
parent04eb1efcd614d6f067b76a355b3a3599667959dc (diff)
downloadlinux-09ac6a817bd687e7f5dac00470262efdd72f9319.tar.bz2
ASoC: soc-core: fix init platform memory handling
snd_soc_init_platform initializes pointers to snd_soc_dai_link which is statically allocated and it does this by devm_kzalloc. In the event of an EPROBE_DEFER the memory will be freed and the pointers are left dangling. snd_soc_init_platform sees the dangling pointers and assumes they are pointing to initialized memory and does not reallocate them on the second probe attempt which results in a use after free bug since devm has freed the memory from the first probe attempt. Since the intention for snd_soc_dai_link->platform is that it can be set statically by the machine driver we need to respect the pointer in the event we did not set it but still catch dangling pointers. The solution is to add a flag to track whether the pointer was dynamically allocated or not. Signed-off-by: Curtis Malainey <cujomalainey@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'include/sound')
-rw-r--r--include/sound/soc.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 8ec1de856ee7..e665f111b0d2 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -985,6 +985,12 @@ struct snd_soc_dai_link {
/* Do not create a PCM for this DAI link (Backend link) */
unsigned int ignore:1;
+ /*
+ * This driver uses legacy platform naming. Set by the core, machine
+ * drivers should not modify this value.
+ */
+ unsigned int legacy_platform:1;
+
struct list_head list; /* DAI link list of the soc card */
struct snd_soc_dobj dobj; /* For topology */
};