Blob Blame History Raw
From b9f098aa7ae2a022dee06a8ca363e3e0e077f05a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Amadeusz=20S=C5=82awi=C5=84ski?= <amadeuszx.slawinski@linux.intel.com>
Date: Thu, 7 Jul 2022 14:57:01 +0200
Subject: [PATCH] ASoC: codecs: rt274: Set component to NULL on remove
Mime-version: 1.0
Content-type: text/plain; charset=UTF-8
Content-transfer-encoding: 8bit
Git-commit: b9f098aa7ae2a022dee06a8ca363e3e0e077f05a
Patch-mainline: v6.0-rc1
References: jsc#PED-850

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-6-amadeuszx.slawinski@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Acked-by: Takashi Iwai <tiwai@suse.de>

---
 sound/soc/codecs/rt274.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/rt274.c b/sound/soc/codecs/rt274.c
index 6b208f9eb503..f2c50b11e4d0 100644
--- a/sound/soc/codecs/rt274.c
+++ b/sound/soc/codecs/rt274.c
@@ -993,6 +993,7 @@ static void rt274_remove(struct snd_soc_component *component)
 	struct rt274_priv *rt274 = snd_soc_component_get_drvdata(component);
 
 	cancel_delayed_work_sync(&rt274->jack_detect_work);
+	rt274->component = NULL;
 }
 
 #ifdef CONFIG_PM
-- 
2.35.3