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

Commit 2eb2e613 authored by Vatsal Bucha's avatar Vatsal Bucha Committed by Gerrit - the friendly Code Review server
Browse files

ASoC: Fix null pointer dereference for prtd pointer



Private data pointer may not be initialized before
access it in adsp_stream_cmd_put. NULL check for prtd
avoids the issue.

CRs-Fixed: 2250112
Change-Id: I0a033d7e867b183c329941b57b49232729191f1b
Signed-off-by: default avatarVatsal Bucha <vbucha@codeaurora.org>
parent ffb86ea0
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -686,6 +686,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
	if (!prtd->audio_client) {
	if (!prtd->audio_client) {
		pr_info("%s: Could not allocate memory\n", __func__);
		pr_info("%s: Could not allocate memory\n", __func__);
		kfree(prtd);
		kfree(prtd);
		prtd = NULL;
		return -ENOMEM;
		return -ENOMEM;
	}
	}


@@ -1174,6 +1175,12 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
	}
	}


	prtd = substream->runtime->private_data;
	prtd = substream->runtime->private_data;
	if (prtd == NULL) {
		pr_err("%s prtd is null.\n", __func__);
		ret = -EINVAL;
		goto done;
	}

	if (prtd->audio_client == NULL) {
	if (prtd->audio_client == NULL) {
		pr_err("%s prtd is null.\n", __func__);
		pr_err("%s prtd is null.\n", __func__);
		ret = -EINVAL;
		ret = -EINVAL;