Browse Source

qcacld-3.0: Validate SAR2 response event handle

Validate SAR2 response event handle and pass the valid
pointer for result extraction

Change-Id: I91982c411c77494662f6d00de6078622a3d548ae
CRs-Fixed: 2259373
Kabilan Kannan 6 years ago
parent
commit
ebe01e7a16
2 changed files with 20 additions and 4 deletions
  1. 2 2
      core/wma/inc/wma_internal.h
  2. 18 2
      core/wma/src/wma_features.c

+ 2 - 2
core/wma/inc/wma_internal.h

@@ -1068,13 +1068,13 @@ QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
 
 /**
  * wma_sar_rsp_evt_handler() -  process sar response event from FW.
- * @handle: wma handle
+ * @handle: ol scn handle
  * @event: event buffer
  * @len: buffer length
  *
  * Return: 0 for success or error code
  */
-int wma_sar_rsp_evt_handler(void *handle, uint8_t *event, uint32_t len);
+int wma_sar_rsp_evt_handler(ol_scn_t handle, uint8_t *event, uint32_t len);
 
 #ifdef FEATURE_WLAN_CH_AVOID
 QDF_STATUS wma_process_ch_avoid_update_req(tp_wma_handle wma_handle,

+ 18 - 2
core/wma/src/wma_features.c

@@ -4032,11 +4032,27 @@ QDF_STATUS wma_set_led_flashing(tp_wma_handle wma_handle,
 }
 #endif /* WLAN_FEATURE_GPIO_LED_FLASHING */
 
-int wma_sar_rsp_evt_handler(void *handle, uint8_t *event, uint32_t len)
+int wma_sar_rsp_evt_handler(ol_scn_t handle, uint8_t *event, uint32_t len)
 {
+	tp_wma_handle wma_handle;
+	wmi_unified_t wmi_handle;
 	QDF_STATUS status;
 
-	status = wmi_unified_extract_sar2_result_event(handle,
+	WMA_LOGD(FL("handle:%pK event:%pK len:%u"), handle, event, len);
+
+	wma_handle = handle;
+	if (!wma_handle) {
+		WMA_LOGE(FL("NULL wma_handle"));
+		return QDF_STATUS_E_INVAL;
+	}
+
+	wmi_handle = wma_handle->wmi_handle;
+	if (!wmi_handle) {
+		WMA_LOGE(FL("NULL wmi_handle"));
+		return QDF_STATUS_E_INVAL;
+	}
+
+	status = wmi_unified_extract_sar2_result_event(wmi_handle,
 						       event, len);
 	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE(FL("Event extract failure: %d"), status);