mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-26 06:33:19 -04:00
soc: qcom: mem-buf: Fix memory leak in mem_buf_alloc()
When mem_buf_alloc() encounters an error after mapping the memory in the stage-2 page tables of the VM, the SGL descriptor is not freed in the error handling path, so free it. Change-Id: I6e6fa296311575bb55cd0b9da7a138970e8b8e74 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
e00c38307d
commit
2b91868a72
1 changed files with 7 additions and 2 deletions
|
|
@ -1458,12 +1458,17 @@ void *mem_buf_alloc(struct mem_buf_allocation_data *alloc_data)
|
|||
return membuf;
|
||||
|
||||
err_get_file:
|
||||
if (mem_buf_remove_mem(membuf) < 0)
|
||||
if (mem_buf_remove_mem(membuf) < 0) {
|
||||
kfree(membuf->sgl_desc);
|
||||
goto err_mem_req;
|
||||
}
|
||||
err_add_mem:
|
||||
if (mem_buf_unmap_mem_s1(membuf->sgl_desc) < 0)
|
||||
if (mem_buf_unmap_mem_s1(membuf->sgl_desc) < 0) {
|
||||
kfree(membuf->sgl_desc);
|
||||
goto err_mem_req;
|
||||
}
|
||||
err_map_mem_s1:
|
||||
kfree(membuf->sgl_desc);
|
||||
if (mem_buf_unmap_mem_s2(membuf->memparcel_hdl) < 0)
|
||||
goto err_mem_req;
|
||||
err_map_mem_s2:
|
||||
|
|
|
|||
Loading…
Reference in a new issue