Skip to content

Commit 860ac44

Browse files
committed
Merge tag 'camera-kernel.qclinux.1.0-251125' into 0_0
* tag 'camera-kernel.qclinux.1.0-251125': msm: camera: sensor: enable sensor config flags for qcs615 msm: camera: ope: Avoid UAF in ope driver msm: camera: isp: Fix for Init Config Handling on Offline IFE Hardware msm: camera: utils: Validate buffer offset properly during dump msm: camera: common: synchronization in CRM close and subdev register msm: camera: sensor: fix of graph error for sensor endpoint msm: camera: reqmgr: adding support sched_req ver3 msm: camera: uapi: new structure for SAT frame sync msm: camera: tpg: fix issue when create debugfs for tpg msm: camera: common: Added qcs615 in Makefile msm: camera: lrme: Fix compilation issues in LRME driver msm: camera: common: Add config file for QCS615 msm: camera: ope: Fix OOB write in cam_cdm_write_regrandom msm: camera: cci: Add sysfs utility to control cci and sensor powerup Revert "msm: camera: isp: Test code to simulate a SOF freeze scenario" msm: camera: flash: Copy flash info to avoid TOCTOU msm: camera: isp: Test code to simulate a SOF freeze scenario msm: camera: sensor: Validate packet to prevent OOB access msm: camera: cre: Fix out-of-bounds access in cre hw manager msm: camera: jpeg: Fix potential out of bound access for jpeg cmd buffer msm: camera: flash: Add support for I2C flash msm: camera: cam_req: Added support to extend delay during SOF Freeze Change-Id: If6591a7ac91ce0f9d3f23e26b0ceb10c27ecec9d Signed-off-by: Chandan Kumar Jha <cjha@qti.qualcomm.com>
2 parents 1c46d84 + 102c7a6 commit 860ac44

56 files changed

Lines changed: 2297 additions & 191 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Kbuild

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,9 @@ camera_$(CAMERA_ARCH)-$(CONFIG_SPECTRA_TFE) += \
659659
camera/drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_csid_hw/cam_tfe_csid.o \
660660
camera/drivers/cam_isp/isp_hw_mgr/cam_tfe_hw_mgr.o
661661

662+
camera_$(CAMERA_ARCH)-$(CONFIG_SPECTRA_SENSOR_SYSFS_UTIL) += \
663+
camera/drivers/cam_sensor_module/cam_cci/cam_cci_sysfs_util.o
664+
662665
camera_$(CAMERA_ARCH)-y += camera/drivers/camera_main.o
663666

664667
obj-m += camera_$(CAMERA_ARCH).o

camera/drivers/cam_cre/cam_cre_hw_mgr/cam_cre_hw_mgr.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
33
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2022-2025, Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
55
*/
66

77
#include <linux/mutex.h>
@@ -137,6 +137,13 @@ static int cam_cre_mgr_process_cmd_io_buf_req(struct cam_cre_hw_mgr *hw_mgr,
137137
struct cam_buf_io_cfg *io_cfg_ptr = NULL;
138138
struct cam_cre_io_buf_info *acq_io_buf;
139139

140+
if (!ctx_data->cre_acquire.batch_size ||
141+
(ctx_data->cre_acquire.batch_size > CRE_MAX_BATCH_SIZE)) {
142+
CAM_ERR(CAM_CRE, "Invalid batch_size: %u ctx id: %u max_batch_size: %u",
143+
ctx_data->cre_acquire.batch_size, ctx_data->ctx_id, CRE_MAX_BATCH_SIZE);
144+
return -EINVAL;
145+
}
146+
140147
io_cfg_ptr = (struct cam_buf_io_cfg *)((uint32_t *)&packet->payload_flex +
141148
packet->io_configs_offset / 4);
142149

@@ -163,6 +170,17 @@ static int cam_cre_mgr_process_cmd_io_buf_req(struct cam_cre_hw_mgr *hw_mgr,
163170
}
164171

165172
io_buf = cre_request->io_buf[i][j];
173+
174+
if (!acq_io_buf->num_planes ||
175+
(acq_io_buf->num_planes > CAM_PACKET_MAX_PLANES)) {
176+
CAM_ERR(CAM_CRE,
177+
"i %d j %d res_type %d Invalid num_planes: %u ctx id: %u max_planes: %u",
178+
i, j, acq_io_buf->res_id, acq_io_buf->num_planes,
179+
ctx_data->ctx_id, CAM_PACKET_MAX_PLANES);
180+
cam_cre_free_io_config(cre_request);
181+
return -EINVAL;
182+
}
183+
166184
io_buf->num_planes = acq_io_buf->num_planes;
167185
io_buf->resource_type = acq_io_buf->res_id;
168186
io_buf->direction = acq_io_buf->direction;

camera/drivers/cam_isp/cam_isp_context.c

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4356,6 +4356,9 @@ static int __cam_isp_ctx_handle_error(struct cam_isp_context *ctx_isp,
43564356
__cam_isp_ctx_notify_error_util(CAM_TRIGGER_POINT_SOF, error,
43574357
error_request_id, ctx_isp);
43584358

4359+
if (ctx_isp->isp_external_recovery)
4360+
req_mgr_err_code = CAM_REQ_MGR_ISP_FATAL_ERROR;
4361+
43594362
/*
43604363
* Need to send error occurred in KMD
43614364
* This will help UMD to take necessary action
@@ -7160,6 +7163,7 @@ static int __cam_isp_ctx_release_dev_in_top_state(struct cam_context *ctx,
71607163
ctx_isp->req_info.last_bufdone_req_id = 0;
71617164
ctx_isp->v4l2_event_sub_ids = 0;
71627165
ctx_isp->resume_hw_in_flushed = false;
7166+
ctx_isp->isp_external_recovery = false;
71637167

71647168
atomic64_set(&ctx_isp->dbg_monitors.state_monitor_head, -1);
71657169
atomic64_set(&ctx_isp->dbg_monitors.frame_monitor_head, -1);
@@ -9062,7 +9066,7 @@ static int __cam_isp_ctx_process_evt(struct cam_context *ctx,
90629066
struct cam_isp_context *ctx_isp =
90639067
(struct cam_isp_context *) ctx->ctx_priv;
90649068

9065-
if ((ctx->state == CAM_CTX_ACQUIRED) &&
9069+
if ((ctx->state == CAM_CTX_ACQUIRED || ctx->state == CAM_CTX_READY) &&
90669070
(link_evt_data->evt_type != CAM_REQ_MGR_LINK_EVT_UPDATE_PROPERTIES)) {
90679071
CAM_WARN(CAM_ISP,
90689072
"Get unexpect evt:%d in acquired state, ctx: %u on link: 0x%x",
@@ -9102,12 +9106,17 @@ static int __cam_isp_ctx_process_evt(struct cam_context *ctx,
91029106
break;
91039107
case CAM_REQ_MGR_LINK_EVT_UPDATE_PROPERTIES:
91049108
if (link_evt_data->u.properties_mask &
9109+
CAM_LINK_PROPERTY_SENSOR_EXTERNAL_RECOVERY)
9110+
ctx_isp->isp_external_recovery = true;
9111+
else if (link_evt_data->u.properties_mask &
91059112
CAM_LINK_PROPERTY_SENSOR_STANDBY_AFTER_EOF)
91069113
ctx_isp->vfps_aux_context = true;
91079114
else
91089115
ctx_isp->vfps_aux_context = false;
9109-
CAM_DBG(CAM_ISP, "vfps_aux_context:%s on ctx: %u link: 0x%x",
9110-
CAM_BOOL_TO_YESNO(ctx_isp->vfps_aux_context), ctx->ctx_id, ctx->link_hdl);
9116+
CAM_DBG(CAM_ISP, "vfps_aux_context:%s external recovery:%s on ctx: %u link: 0x%x",
9117+
CAM_BOOL_TO_YESNO(ctx_isp->vfps_aux_context),
9118+
CAM_BOOL_TO_YESNO(ctx_isp->isp_external_recovery),
9119+
ctx->ctx_id, ctx->link_hdl);
91119120
break;
91129121
default:
91139122
CAM_WARN(CAM_ISP,
@@ -9502,6 +9511,7 @@ static struct cam_ctx_ops
95029511
.unlink = __cam_isp_ctx_unlink_in_ready,
95039512
.get_dev_info = __cam_isp_ctx_get_dev_info,
95049513
.flush_req = __cam_isp_ctx_flush_req_in_ready,
9514+
.process_evt = __cam_isp_ctx_process_evt,
95059515
.dump_req = __cam_isp_ctx_dump_in_top_state,
95069516
},
95079517
.irq_ops = NULL,

camera/drivers/cam_isp/cam_isp_context.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ struct cam_isp_fcg_prediction_tracker {
431431
* @flush_in_progress indicates whether flush is in progress
432432
* @bubble_recover_dis: Bubble recovery disabled
433433
* @sfe_en: Indicates if SFE is being used
434+
* @isp_external_recovery: Indicates if external recovery enabled
434435
*/
435436
struct cam_isp_context {
436437
struct cam_context *base;
@@ -500,6 +501,7 @@ struct cam_isp_context {
500501
struct mutex isp_mutex;
501502
bool bubble_recover_dis;
502503
bool sfe_en;
504+
bool isp_external_recovery;
503505
};
504506

505507
/**

camera/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8108,7 +8108,7 @@ int cam_ife_mgr_config_hw(
81088108
c_ctx->curr_num_exp = hw_update_data->num_exp;
81098109
}
81108110
hw_update_data->mup_en = false;
8111-
8111+
c_ctx->flags.init_cfg_done = true;
81128112
/* Try for INIT packet reg dump by default - no debugfs set */
81138113
if (cfg->init_packet && !g_ife_hw_mgr.debug_cfg.per_req_reg_dump)
81148114
cam_ife_mgr_handle_reg_dump(hw_mgr_ctx,
@@ -8489,6 +8489,7 @@ static int cam_ife_mgr_stop_hw(void *hw_mgr_priv, void *stop_hw_args)
84898489
end:
84908490
c_ctx->flags.dump_on_error = false;
84918491
c_ctx->flags.dump_on_flush = false;
8492+
c_ctx->flags.init_cfg_done = false;
84928493
return rc;
84938494
}
84948495

camera/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ struct cam_ife_hw_mgr_ctx_scratch_buf_info {
208208
* @rdi_pd_context: Flag to specify the context has
209209
* only rdi and PD resource without PIX port.
210210
* @per_port_en: Indicates if per port feature is enabled or not
211+
* @init_cfg_done: indicate whether init configuration for hw is done or not.
211212
212213
*/
213214
struct cam_ife_hw_mgr_ctx_flags {
@@ -231,6 +232,7 @@ struct cam_ife_hw_mgr_ctx_flags {
231232
bool sys_cache_usage[CAM_LLCC_MAX];
232233
bool rdi_pd_context;
233234
bool per_port_en;
235+
bool init_cfg_done;
234236
};
235237

236238
/**

camera/drivers/cam_isp/isp_hw_mgr/cam_ife_hw_mgr_addons.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,15 @@ int cam_ife_mgr_check_start_processing(void *hw_mgr_priv,
183183
list_for_each_entry_safe(c_elem, c_elem_temp,
184184
&ife_hw_mgr->input_queue.list, list) {
185185
is_init_pkt =
186-
((c_elem->prepare.packet->header.op_code + 1) &
187-
0xF) == CAM_ISP_PACKET_INIT_DEV;
186+
(((c_elem->prepare.packet->header.op_code + 1) & 0xF) ==
187+
CAM_ISP_PACKET_INIT_DEV);
188+
if ((c_ctx->flags.init_cfg_done && is_init_pkt) ||
189+
(!(c_ctx->flags.init_cfg_done) && !(is_init_pkt))) {
190+
CAM_DBG(CAM_ISP, "#REJECT#: %s ctx id %d hw_id %d",
191+
c_ctx->flags.init_cfg_done ? "Init already done" : "Init not done",
192+
c_ctx->ctx_index, c_ctx->acquired_hw_id);
193+
continue;
194+
}
188195
if (c_ctx->waiting_start &&
189196
c_elem->ctx_idx != c_ctx->start_ctx_idx) {
190197
CAM_DBG(CAM_ISP,

camera/drivers/cam_isp/isp_hw_mgr/isp_hw/ife_csid_hw/cam_ife_csid_hw_ver2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5560,7 +5560,7 @@ static int cam_ife_csid_ver2_deinit_hw(void *hw_priv,
55605560
return -EINVAL;
55615561
}
55625562

5563-
if (res->res_state == CAM_ISP_RESOURCE_STATE_RESERVED) {
5563+
if (res->res_state <= CAM_ISP_RESOURCE_STATE_RESERVED) {
55645564
CAM_DBG(CAM_ISP, "CSID:%u Res:%d already in De-init state",
55655565
csid_hw->hw_intf->hw_idx,
55665566
res->res_id);

camera/drivers/cam_jpeg/jpeg_hw/cam_jpeg_hw_mgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// SPDX-License-Identifier: GPL-2.0-only
22
/*
33
* Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
4-
* Copyright (c) 2022-2025, Qualcomm Innovation Center, Inc. All rights reserved.
4+
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
55
*/
66

77
#include <linux/uaccess.h>
@@ -687,8 +687,8 @@ static int cam_jpeg_insert_cdm_change_base(
687687
return rc;
688688
}
689689

690-
if (config_args->hw_update_entries[CAM_JPEG_CHBASE_CMD_BUFF_IDX].offset >=
691-
ch_base_len) {
690+
if ((config_args->hw_update_entries[CAM_JPEG_CHBASE_CMD_BUFF_IDX].offset +
691+
(2 * sizeof(uint32_t))) >= ch_base_len) {
692692
CAM_ERR(CAM_JPEG, "Not enough buf offset %d len %d",
693693
config_args->hw_update_entries[CAM_JPEG_CHBASE_CMD_BUFF_IDX].offset,
694694
ch_base_len);

camera/drivers/cam_lrme/cam_lrme_context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static struct cam_ctx_ops
231231
int cam_lrme_context_init(struct cam_lrme_context *lrme_ctx,
232232
struct cam_context *base_ctx,
233233
struct cam_hw_mgr_intf *hw_intf,
234-
uint32_t index
234+
uint32_t index,
235235
int img_iommu_hdl)
236236
{
237237
int rc = 0;

0 commit comments

Comments
 (0)