OSDN Git Service

ASoC: core: Fix possible NULL pointer dereference
authorMeng Wang <mwang@codeaurora.org>
Mon, 7 Aug 2017 04:05:24 +0000 (12:05 +0800)
committerGerrit - the friendly Code Review server <code-review@localhost>
Tue, 22 Aug 2017 06:05:03 +0000 (23:05 -0700)
When SSR is triggered when the system does not have a sound card
registered, but has codecs. The pointer card sent from codec driver
to snd_soc_card_change_online_state is NULL. Add null check for soc_card
before dereferencing.

Change-Id: I23342a6cbd9d53e62b2ea11dfe79aad3759df6f0
Signed-off-by: Meng Wang <mwang@codeaurora.org>
sound/soc/soc-core.c

index e63b434..fae57d1 100644 (file)
@@ -3063,7 +3063,8 @@ static int snd_soc_codec_set_bias_level(struct snd_soc_dapm_context *dapm,
  */
 void snd_soc_card_change_online_state(struct snd_soc_card *soc_card, int online)
 {
-       snd_card_change_online_state(soc_card->snd_card, online);
+       if (soc_card && soc_card->snd_card)
+               snd_card_change_online_state(soc_card->snd_card, online);
 }
 EXPORT_SYMBOL(snd_soc_card_change_online_state);