alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majczak <lma@semihalf.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Mateusz Gorski <mateusz.gorski@linux.intel.com>
Cc: alsa-devel@alsa-project.org, Guenter Roeck <groeck@google.com>,
	Radoslaw Biernacki <rad@semihalf.com>,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org,
	Marcin Wojtas <mw@semihalf.com>,
	Lukasz Majczak <lma@semihalf.com>,
	Alex Levin <levinale@google.com>
Subject: [PATCH v2] ASoC: Intel: Skylake: Check the kcontrol against NULL
Date: Thu, 17 Dec 2020 14:04:39 +0100	[thread overview]
Message-ID: <20201217130439.141943-1-lma@semihalf.com> (raw)
In-Reply-To: <20201210121438.7718-1-lma@semihalf.com>

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>
Reviewed-by: Mateusz Gorski <mateusz.gorski@linux.intel.com>
---
 sound/soc/intel/skylake/skl-topology.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
 v1 -> v2: fixed coding style

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index ae466cd592922..8f0bfda7096a9 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)
-- 
2.25.1


  parent reply	other threads:[~2020-12-17 13:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Lukasz Majczak [this message]
2021-01-12 11:34   ` [PATCH v2] " Ł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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201217130439.141943-1-lma@semihalf.com \
    --to=lma@semihalf.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=groeck@google.com \
    --cc=levinale@google.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mateusz.gorski@linux.intel.com \
    --cc=mw@semihalf.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=rad@semihalf.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).