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

Commit 7da558b7 authored by Kuirong Wang's avatar Kuirong Wang
Browse files

ASoC: msm: Check the pointers before memcpy



Check the pointers before memcpy when the application queries
the adsp capability for compressed audio. Invalid pointer
can cause kernel panic when doing memcpy.

CRs-fixed: 665297
Change-Id: I522deffc42f792b8dfdcf50272a80cd0d1e5a9ee
Signed-off-by: default avatarKuirong Wang <kuirongw@codeaurora.org>
parent 65c7182d
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1616,11 +1616,17 @@ static int msm_compr_get_caps(struct snd_compr_stream *cstream,
{
	struct snd_compr_runtime *runtime = cstream->runtime;
	struct msm_compr_audio *prtd = runtime->private_data;
	int ret = 0;

	pr_debug("%s\n", __func__);
	if ((arg != NULL) && (prtd != NULL)) {
		memcpy(arg, &prtd->compr_cap, sizeof(struct snd_compr_caps));
	} else {
		ret = -EINVAL;
		pr_err("%s: arg (0x%p), prtd (0x%p)\n", __func__, arg, prtd);
	}

	return 0;
	return ret;
}

static int msm_compr_get_codec_caps(struct snd_compr_stream *cstream,