Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e51b157 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: ensure check before accessing session private data."

parents ff2f0b8b 64e3b7ea
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -167,6 +167,10 @@ static int msm_compr_set_volume(struct snd_compr_stream *cstream,

	pr_debug("%s: volume_l %d volume_r %d\n",
		__func__, volume_l, volume_r);
	if (!cstream || !cstream->runtime) {
		pr_err("%s: session not active\n", __func__);
		return -EPERM;
	}
	prtd = cstream->runtime->private_data;
	if (prtd && prtd->audio_client) {
		if (volume_l != volume_r) {
@@ -720,6 +724,7 @@ static int msm_compr_open(struct snd_compr_stream *cstream)
		 kzalloc(sizeof(struct msm_compr_audio_effects), GFP_KERNEL);
	if (!pdata->audio_effects[rtd->dai_link->be_id]) {
		pr_err("%s: Could not allocate memory for effects\n", __func__);
		pdata->cstream[rtd->dai_link->be_id] = NULL;
		kfree(prtd);
		return -ENOMEM;
	}
@@ -728,6 +733,8 @@ static int msm_compr_open(struct snd_compr_stream *cstream)
	if (!pdata->dec_params[rtd->dai_link->be_id]) {
		pr_err("%s: Could not allocate memory for dec params\n",
			__func__);
		kfree(pdata->audio_effects[rtd->dai_link->be_id]);
		pdata->cstream[rtd->dai_link->be_id] = NULL;
		kfree(prtd);
		return -ENOMEM;
	}
@@ -737,6 +744,7 @@ static int msm_compr_open(struct snd_compr_stream *cstream)
		pr_err("%s: Could not allocate memory for client\n", __func__);
		kfree(pdata->audio_effects[rtd->dai_link->be_id]);
		kfree(pdata->dec_params[rtd->dai_link->be_id]);
		pdata->cstream[rtd->dai_link->be_id] = NULL;
		kfree(prtd);
		return -ENOMEM;
	}