msm: camera: isp: Fix the potential issue caused by list operation

In function cam_ife_hw_mgr_acquire_res_ife_csid_pxl, if csid_res is added
to res_list_ife_csid, and if no_res_acquired is true, the csid_res will be
add to free_res_list without list delete operation, this will damage the
res_list_ife_csid.

CRs-Fixed: 3272891
Change-Id: Ic6ee6edeed8dce82fb7a2907daf5fa634cca8a7f
Signed-off-by: mingpan <quic_mingpan@quicinc.com>
This commit is contained in:
mingpan
2022-08-22 09:58:15 +08:00
gecommit door Camera Software Integration
bovenliggende 5de7a991f7
commit 3131e4321b

Bestand weergeven

@@ -3544,8 +3544,7 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
bool is_ipp,
bool crop_enable)
{
int rc = -1, i;
bool no_res_acquired = true;
int rc = 0, i;
struct cam_isp_out_port_generic_info *out_port = NULL;
struct cam_ife_hw_mgr *ife_hw_mgr;
struct cam_isp_hw_mgr_res *csid_res;
@@ -3618,10 +3617,9 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
CAM_ERR(CAM_ISP,
"Cannot acquire ife csid pxl path rsrc %s",
(is_ipp) ? "IPP" : "PPP");
goto put_res;
goto end;
}
no_res_acquired = false;
csid_res->hw_res[i] = csid_acquire.node_res;
hw_intf = csid_res->hw_res[i]->hw_intf;
@@ -3675,10 +3673,6 @@ static int cam_ife_hw_mgr_acquire_res_ife_csid_pxl(
}
}
return 0;
put_res:
if (no_res_acquired)
cam_ife_hw_mgr_put_res(&ife_ctx->free_res_list, &csid_res);
end:
return rc;
}
@@ -4461,7 +4455,7 @@ static int cam_ife_hw_mgr_acquire_offline_res_csid(
CAM_ERR(CAM_ISP,
"CSID Path reserve failed rc=%d res_id=%d",
rc, path_res_id);
goto end;
goto put_res;
}
if (!ife_ctx->buf_done_controller && csid_acquire.buf_done_controller)
@@ -4475,6 +4469,11 @@ static int cam_ife_hw_mgr_acquire_offline_res_csid(
csid_res->hw_res[1] = NULL;
cam_ife_hw_mgr_put_res(&ife_ctx->res_list_ife_csid, &csid_res);
return 0;
put_res:
cam_ife_hw_mgr_put_res(&ife_ctx->free_res_list, &csid_res);
end:
return rc;
}