alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Intel: Skylake: Check the kcontrol against NULL
@ 2020-12-10 12:14 Lukasz Majczak
  2020-12-10 15:55 ` Gorski, Mateusz
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Lukasz Majczak @ 2020-12-10 12:14 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Liam Girdwood, Mateusz Gorski
  Cc: alsa-devel, Guenter Roeck, Radoslaw Biernacki, linux-kernel,
	stable, Marcin Wojtas, Lukasz Majczak, Alex Levin

There is no check for the kcontrol against NULL and in some cases
it causes kernel to crash.

Fixes: 2d744ecf2b984 ("ASoC: Intel: Skylake: Automatic DMIC format configuration according to information from NHLT")
Cc: <stable@vger.kernel.org> # 5.4+
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
---
 sound/soc/intel/skylake/skl-topology.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index ae466cd592922..c9abbe4ff0ba3 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -3618,12 +3618,18 @@ static void skl_tplg_complete(struct snd_soc_component *component)
 	int i;
 
 	list_for_each_entry(dobj, &component->dobj_list, list) {
-		struct snd_kcontrol *kcontrol = dobj->control.kcontrol;
-		struct soc_enum *se =
-			(struct soc_enum *)kcontrol->private_value;
-		char **texts = dobj->control.dtexts;
+		struct snd_kcontrol *kcontrol;
+		struct soc_enum *se;
+		char **texts;
 		char chan_text[4];
 
+		kcontrol = dobj->control.kcontrol;
+		if(!kcontrol)
+			continue;
+
+		se = (struct soc_enum *)kcontrol->private_value;
+		texts = dobj->control.dtexts;
+
 		if (dobj->type != SND_SOC_DOBJ_ENUM ||
 		    dobj->control.kcontrol->put !=
 		    skl_tplg_multi_config_set_dmic)

base-commit: 69fe63aa100220c8fd1f451dd54dd0895df1441d
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-01-20 16:46 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 12:14 [PATCH] ASoC: Intel: Skylake: Check the kcontrol against NULL Lukasz Majczak
2020-12-10 15:55 ` Gorski, Mateusz
2020-12-10 16:01   ` Guenter Roeck
2020-12-11 15:42 ` Amadeusz Sławiński
2020-12-17 13:04 ` [PATCH v2] " Lukasz Majczak
2021-01-12 11:34   ` Łukasz Majczak
2021-01-20 15:49     ` Łukasz Majczak
2021-01-20 16:33       ` Pierre-Louis Bossart
2021-01-20 16:41         ` Rojewski, Cezary
2021-01-20 16:45           ` Rojewski, Cezary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).