ASoC: codecs: rt298: Set component to NULL on remove
authorAmadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Thu, 7 Jul 2022 12:57:00 +0000 (14:57 +0200)
committerMark Brown <broonie@kernel.org>
Mon, 11 Jul 2022 13:59:09 +0000 (14:59 +0100)
Make sure that component is set to proper value, otherwise we may
dereference freed component in interrupt.

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://lore.kernel.org/r/20220707125701.3518263-5-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/rt298.c

index e1d94f1..b0b53d4 100644 (file)
@@ -1022,6 +1022,7 @@ static void rt298_remove(struct snd_soc_component *component)
        struct rt298_priv *rt298 = snd_soc_component_get_drvdata(component);
 
        cancel_delayed_work_sync(&rt298->jack_detect_work);
+       rt298->component = NULL;
 }
 
 #ifdef CONFIG_PM