summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorGuennadi Liakhovetski2019-02-01 18:05:13 +0100
committerMark Brown2019-02-02 17:13:28 +0100
commit52abe6cc1866ac3d54612f5d80563e6608c0ddfc (patch)
treee003e0a1cc378513a2a3cfc505f373a40d42b069 /sound/soc/soc-core.c
parentASoC: rsnd: fixup MIX kctrl registration (diff)
downloadkernel-qcow2-linux-52abe6cc1866ac3d54612f5d80563e6608c0ddfc.tar.gz
kernel-qcow2-linux-52abe6cc1866ac3d54612f5d80563e6608c0ddfc.tar.xz
kernel-qcow2-linux-52abe6cc1866ac3d54612f5d80563e6608c0ddfc.zip
ASoC: topology: fix oops/use-after-free case with dai driver
rmmod/modprobe tests expose a kernel oops when accessing the dai driver pointer. This comes from the topology design which operates in multiple passes. Each object removal happens at a specific iteration, and the code checks for the iteration (order) number after the memory containing the order was freed. Fix this be clearing a reference to the dai driver and check its validity to avoid dereferences. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ea16c2b199ce..50617db05c46 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -956,7 +956,7 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order)
{
int err;
- if (!dai || !dai->probed ||
+ if (!dai || !dai->probed || !dai->driver ||
dai->driver->remove_order != order)
return;