Skip to content
This repository has been archived by the owner on Jul 7, 2021. It is now read-only.

Commit

Permalink
msm: camera: Fix memory leak
Browse files Browse the repository at this point in the history
CAF never deattaches the dma buffer, creating a memory leak
every time this function is run. This issue becomes increasingly
problematic as it's run a metric ton every time camera is open,
which on Coral is pretty much every time you unlock the phone
and often while you run it too. Fix it by unmaping and detaching
the dma buffer.

Reported-by: celtare21 <celtare21@gmail.com>
Signed-off-by: Demon000 <demonsingur@gmail.com>
Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>
  • Loading branch information
Demon000 authored and 0ctobot committed May 22, 2020
1 parent 6d738f8 commit b376ab6
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/media/platform/msm/camera/cam_smmu/cam_smmu_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -2415,14 +2415,13 @@ static int cam_smmu_map_stage2_buffer_and_add_to_list(int idx, int ion_fd,
/* add to the list */
list_add(&mapping_info->list, &iommu_cb_set.cb_info[idx].smmu_buf_list);

return 0;

err_unmap_sg:
dma_buf_unmap_attachment(attach, table, dma_dir);
err_detach:
dma_buf_detach(dmabuf, attach);
err_put:
dma_buf_put(dmabuf);
if (rc)
dma_buf_put(dmabuf);
err_out:
return rc;
}
Expand Down

0 comments on commit b376ab6

Please sign in to comment.