ASoC: qdsp6v2: 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: 2252497 Change-Id: Ibd888be601d5b42ed4f4644ed22596a26b61f8fe Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
parent
9912a8c48b
commit
b9e306af63
1 changed files with 7 additions and 0 deletions
|
@ -660,6 +660,7 @@ static int msm_pcm_open(struct snd_pcm_substream *substream)
|
|||
if (!prtd->audio_client) {
|
||||
pr_info("%s: Could not allocate memory\n", __func__);
|
||||
kfree(prtd);
|
||||
prtd = NULL;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1135,6 +1136,12 @@ static int msm_pcm_adsp_stream_cmd_put(struct snd_kcontrol *kcontrol,
|
|||
}
|
||||
|
||||
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) {
|
||||
pr_err("%s prtd is null.\n", __func__);
|
||||
ret = -EINVAL;
|
||||
|
|
Loading…
Add table
Reference in a new issue