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

Commit bf7efaef authored by Meng Wang's avatar Meng Wang
Browse files

ASoC: msm: qdsp6v2: check if buf is null before using it



buf returned from q6asm_shared_io_buf could be null and
it could cause crash. Check if buf is null before using
it to avoid crash.

CRs-Fixed: 1046606
Change-Id: Ia988b11ff7d03edc4ddd959571da1378da62077c
Signed-off-by: default avatarMeng Wang <mwang@codeaurora.org>
parent 64a109dc
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -375,6 +375,11 @@ static int msm_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
		q6asm_cmd(prtd->audio_client, CMD_PAUSE);
		q6asm_cmd(prtd->audio_client, CMD_FLUSH);
		buf = q6asm_shared_io_buf(prtd->audio_client, dir);
		if (buf == NULL) {
			pr_err("%s: shared IO buffer is null\n", __func__);
			ret = -EINVAL;
			break;
		}
		memset(buf->data, 0, buf->actual_size);
		break;
	case SNDRV_PCM_TRIGGER_SUSPEND: