Browse Source

qcacmn: Fix reachable Assert in convert_target_pdev_id_to_host_pdev_id

Currently, If invalid pdev_id is passed to
convert_target_pdev_id_to_host_pdev_id it results into Assert.

Fix is to remove QDF_ASSERT(0) in convert_target_pdev_id_to_host_pdev_id.
Return WMI_HOST_PDEV_ID_INVALID if convert_target_pdev_id_to_host_pdev_id
receives invalid pdev id.

Change-Id: Icb6a75c3f3664596fbba4532f5b29ed626ba28f2
CRs-Fixed: 2428787
sheenam monga 6 năm trước cách đây
mục cha
commit
57effefdba
2 tập tin đã thay đổi với 14 bổ sung4 xóa
  1. 1 0
      wmi/inc/wmi_unified_param.h
  2. 13 4
      wmi/src/wmi_unified_tlv.c

+ 1 - 0
wmi/inc/wmi_unified_param.h

@@ -7363,6 +7363,7 @@ struct coex_config_params {
 #define WMI_HOST_PDEV_ID_0   0
 #define WMI_HOST_PDEV_ID_1   1
 #define WMI_HOST_PDEV_ID_2   2
+#define WMI_HOST_PDEV_ID_INVALID 0xFFFFFFFF
 
 #ifndef CMN_VDEV_MGR_TGT_IF_ENABLE
 /**

+ 13 - 4
wmi/src/wmi_unified_tlv.c

@@ -109,9 +109,9 @@ static uint32_t convert_target_pdev_id_to_host_pdev_id(uint32_t pdev_id)
 		return WMI_HOST_PDEV_ID_2;
 	}
 
-	QDF_ASSERT(0);
+	WMI_LOGE("Invalid pdev_id");
 
-	return WMI_HOST_PDEV_ID_SOC;
+	return WMI_HOST_PDEV_ID_INVALID;
 }
 
 /**
@@ -10052,8 +10052,13 @@ static QDF_STATUS extract_dfs_radar_detection_event_tlv(
 	}
 
 	radar_event = param_tlv->fixed_param;
+
 	radar_found->pdev_id = convert_target_pdev_id_to_host_pdev_id(
-			radar_event->pdev_id);
+						radar_event->pdev_id);
+
+	if (radar_found->pdev_id == WMI_HOST_PDEV_ID_INVALID)
+		return QDF_STATUS_E_FAILURE;
+
 	radar_found->detection_mode = radar_event->detection_mode;
 	radar_found->chan_freq = radar_event->chan_freq;
 	radar_found->chan_width = radar_event->chan_width;
@@ -11009,8 +11014,12 @@ extract_esp_estimation_ev_param_tlv(wmi_unified_t wmi_handle,
 	}
 	esp_event = param_buf->fixed_param;
 	param->ac_airtime_percentage = esp_event->ac_airtime_percentage;
+
 	param->pdev_id = convert_target_pdev_id_to_host_pdev_id(
-				esp_event->pdev_id);
+						esp_event->pdev_id);
+
+	if (param->pdev_id == WMI_HOST_PDEV_ID_INVALID)
+		return QDF_STATUS_E_FAILURE;
 
 	return QDF_STATUS_SUCCESS;
 }