Procházet zdrojové kódy

msm: camera: isp: Fix KW issue for out_rsrc_data

Check out_rsrc_data for NULL before dreferencing.

CRs-Fixed: 3604707
Signed-off-by: Pranav Sanwal <[email protected]>
Change-Id: I0345859c999b43c24844d9c9a4b6869097711d07
Pranav Sanwal před 1 rokem
rodič
revize
13ff1db7af

+ 12 - 4
drivers/cam_isp/isp_hw_mgr/isp_hw/tfe_hw/cam_tfe_bus.c

@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
  * Copyright (c) 2019-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/ratelimit.h>
@@ -1916,12 +1916,10 @@ static int cam_tfe_bus_rup_bottom_half(
 	struct cam_tfe_bus_priv            *bus_priv,
 	struct cam_tfe_irq_evt_payload *evt_payload)
 {
-	struct cam_tfe_bus_common_data     *common_data;
-	struct cam_tfe_bus_tfe_out_data    *out_rsrc_data;
+	struct cam_tfe_bus_tfe_out_data    *out_rsrc_data = NULL;
 	struct cam_isp_hw_event_info        evt_info;
 	uint32_t i, j;
 
-	common_data = &bus_priv->common_data;
 	evt_info.hw_idx = bus_priv->common_data.core_index;
 	evt_info.res_type = CAM_ISP_RESOURCE_TFE_OUT;
 
@@ -1935,6 +1933,9 @@ static int cam_tfe_bus_rup_bottom_half(
 				out_rsrc_data =
 					(struct cam_tfe_bus_tfe_out_data *)
 					bus_priv->tfe_out[j].res_priv;
+				if (!out_rsrc_data)
+					break;
+
 				if ((out_rsrc_data->rup_group_id == i) &&
 					(bus_priv->tfe_out[j].res_state ==
 					CAM_ISP_RESOURCE_STATE_STREAMING))
@@ -1953,6 +1954,13 @@ static int cam_tfe_bus_rup_bottom_half(
 				bus_priv->common_data.core_index,
 				cam_tfe_bus_rup_type(i));
 			evt_info.res_id = i;
+
+			if (!out_rsrc_data) {
+				CAM_ERR(CAM_ISP,
+					"out_rsrc_data null for out_res: %d, RUP_group: %d",
+					j, i);
+				break;
+			}
 			if (out_rsrc_data->event_cb) {
 				out_rsrc_data->event_cb(
 					out_rsrc_data->priv,