Browse Source

Merge "asoc: add null check for pcm pointer of snd_pcm_volume"

qctecmdr 4 years ago
parent
commit
3b7f4a16ae
2 changed files with 12 additions and 0 deletions
  1. 6 0
      asoc/msm-pcm-q6-noirq.c
  2. 6 0
      asoc/msm-pcm-q6-v2.c

+ 6 - 0
asoc/msm-pcm-q6-noirq.c

@@ -732,6 +732,12 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
 		pr_err("%s: vol is NULL\n", __func__);
 		return -ENODEV;
 	}
+
+	if (!vol->pcm) {
+		pr_err("%s: vol->pcm is NULL\n", __func__);
+		return -ENODEV;
+	}
+
 	substream = vol->pcm->streams[vol->stream].substream;
 	if (!substream) {
 		pr_err("%s substream not found\n", __func__);

+ 6 - 0
asoc/msm-pcm-q6-v2.c

@@ -1530,6 +1530,12 @@ static int msm_pcm_volume_ctl_get(struct snd_kcontrol *kcontrol,
 		pr_err("%s: vol is NULL\n", __func__);
 		return -ENODEV;
 	}
+
+	if (!vol->pcm) {
+		pr_err("%s: vol->pcm is NULL\n", __func__);
+		return -ENODEV;
+	}
+
 	substream = vol->pcm->streams[vol->stream].substream;
 	if (!substream) {
 		pr_err("%s substream not found\n", __func__);