msm: camera: common: Fix possible OOB reads and writes operation
We need to check if the packet is valid before using it. CRs-Fixed: 3605421 Change-Id: Ide4e005ba46690c1cac02cb77a2d9aaa497b15df Signed-off-by: mingpan <quic_mingpan@quicinc.com> (cherry picked from commit 0156c0475a4c6c042eb84fcfbc14b3e837e0cb4c)
This commit is contained in:
@@ -792,6 +792,10 @@ send_cmd_buffers:
|
||||
cmd_desc = (struct cam_cmd_buf_desc *) ((uint8_t *)&packet->payload +
|
||||
packet->cmd_buf_offset);
|
||||
for (i = 0; i < packet->num_cmd_buf; i++) {
|
||||
rc = cam_packet_util_validate_cmd_desc(&cmd_desc[i]);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
CAM_DBG(CAM_PRESIL, "Adding CMD buffer:%d", cmd_desc[i].mem_handle);
|
||||
cam_presil_add_unique_buf_hdl_to_list(cmd_desc[i].mem_handle,
|
||||
unique_cmd_buffers, &num_cmd_handles, CAM_PRESIL_UNIQUE_HDL_MAX);
|
||||
|
Fai riferimento in un nuovo problema
Block a user