Message ID | 20181221090610.GC2735@kadam (mailing list archive) |
---|---|
State | Accepted |
Commit | a41d9dbf5dac5b6a1283ee8001f22807d18352ea |
Headers | show |
Series | [1/2] ASoC: qdsp6: q6asm-dai: Off by one in of_q6asm_parse_dai_data() | expand |
On 21/12/2018 09:06, Dan Carpenter wrote: > We can't return directly if snd_dma_alloc_pages() fails; we first need > to free prtd->audio_client and prtd. > > Fixes: 22930c79ac5c ("ASoC: qdsp6: q6asm-dai: Add support to compress offload") > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> > --- Thanks for the patch! I was due to send something similar! Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c index 3407e51b8861..548eb4fa2da6 100644 --- a/sound/soc/qcom/qdsp6/q6asm-dai.c +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c @@ -573,8 +573,7 @@ static int q6asm_dai_compr_open(struct snd_compr_stream *stream) if (IS_ERR(prtd->audio_client)) { dev_err(dev, "Could not allocate memory\n"); ret = PTR_ERR(prtd->audio_client); - kfree(prtd); - return ret; + goto free_prtd; } size = COMPR_PLAYBACK_MAX_FRAGMENT_SIZE * @@ -583,7 +582,7 @@ static int q6asm_dai_compr_open(struct snd_compr_stream *stream) &prtd->dma_buffer); if (ret) { dev_err(dev, "Cannot allocate buffer(s)\n"); - return ret; + goto free_client; } if (pdata->sid < 0) @@ -596,6 +595,13 @@ static int q6asm_dai_compr_open(struct snd_compr_stream *stream) runtime->private_data = prtd; return 0; + +free_client: + q6asm_audio_client_free(prtd->audio_client); +free_prtd: + kfree(prtd); + + return ret; } static int q6asm_dai_compr_free(struct snd_compr_stream *stream)
We can't return directly if snd_dma_alloc_pages() fails; we first need to free prtd->audio_client and prtd. Fixes: 22930c79ac5c ("ASoC: qdsp6: q6asm-dai: Add support to compress offload") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> --- sound/soc/qcom/qdsp6/q6asm-dai.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)