msm: camera: memmgr: Add missing calls of put buf to avoid leak

This change add missing calls to put cpu buf in few scenarios.

CRs-Fixed: 3578162
Change-Id: Iab6aa0324b5072390b38df296c7acee00f5102a1
Signed-off-by: Vikram Sharma <quic_vikramsa@quicinc.com>
This commit is contained in:
Vikram Sharma
2023-08-30 17:41:43 +05:30
parent 8a04130f3b
commit ec8012559c
18 changed files with 261 additions and 59 deletions

View File

@@ -989,6 +989,7 @@ static int cam_isp_ctx_dump_req(
if (dump_to_buff) {
if (!cpu_addr || !offset || !buf_len) {
CAM_ERR(CAM_ISP, "Invalid args");
cam_mem_put_cpu_buf(req_isp->cfg[i].handle);
break;
}
dump_info.src_start = buf_start;
@@ -999,8 +1000,10 @@ static int cam_isp_ctx_dump_req(
rc = cam_cdm_util_dump_cmd_bufs_v2(
&dump_info);
*offset = dump_info.dst_offset;
if (rc)
if (rc) {
cam_mem_put_cpu_buf(req_isp->cfg[i].handle);
return rc;
}
} else
cam_cdm_util_dump_cmd_buf(buf_start, buf_end);
cam_mem_put_cpu_buf(req_isp->cfg[i].handle);
@@ -1751,7 +1754,6 @@ static int __cam_isp_ctx_handle_buf_done_for_req_list(
req_isp->fence_map_out[i].sync_id,
CAM_SYNC_STATE_SIGNALED_ERROR,
CAM_SYNC_ISP_EVENT_BUBBLE);
list_add_tail(&req->list, &ctx->free_req_list);
CAM_DBG(CAM_REQ,
"Move active request %lld to free list(cnt = %d) [flushed], ctx %u, link: 0x%x",
@@ -5407,12 +5409,13 @@ static int __cam_isp_ctx_dump_in_top_state(
}
goto end;
hw_dump:
rc = cam_mem_get_cpu_buf(dump_info->buf_handle,
rc = cam_mem_get_cpu_buf(dump_info->buf_handle,
&cpu_addr, &buf_len);
if (rc) {
CAM_ERR(CAM_ISP, "Invalid handle %u rc %d, ctx_idx: %u, link: 0x%x",
dump_info->buf_handle, rc, ctx->ctx_id, ctx->link_hdl);
goto end;
spin_unlock_bh(&ctx->lock);
return rc;
}
if (buf_len <= dump_info->offset) {
spin_unlock_bh(&ctx->lock);