dsp: address memleak in msm_audio_ion_map_kernel

dma_vmap is not freed in else case of is_iova, so kfree dma_vmap
when is_iova is false. And also if dma_buf_vmap kernel map is
failed, need to end cpu access dma buf.

Change-Id: I111fb7a2a367a8418f46a7b5fc1459d135d7115e
Signed-off-by: Prasad Kumpatla <quic_pkumpatl@quicinc.com>
This commit is contained in:
Prasad Kumpatla
2023-01-07 11:49:27 +05:30
committed by Gerrit - the friendly Code Review server
parent 04a1c53fe1
commit 8d79e00ae1

View File

@@ -120,6 +120,7 @@ static int msm_audio_ion_map_kernel(struct dma_buf *dma_buf,
if (rc) {
pr_err("%s: kernel mapping of dma_buf failed\n",
__func__);
dma_buf_end_cpu_access(dma_buf, DMA_BIDIRECTIONAL);
goto exit;
}
@@ -205,6 +206,7 @@ static int msm_audio_dma_buf_map(struct dma_buf *dma_buf,
alloc_data->vmap = iosys_vmap;
} else {
*addr = MSM_AUDIO_ION_PHYS_ADDR(alloc_data);
kfree(iosys_vmap);
}
msm_audio_ion_add_allocation(ion_data, alloc_data);