Pārlūkot izejas kodu

qcacld-3.0: update hw/sw info afer modules get closed

As part of stop_modules hif_ctx  will be freed and re-allocated
as part of start_modules. So the target_name pointer in the hdd_ctx
points to a invalid memory.

Mitigate this issue by updating the target_name,hw/sw info during
when the driver_status moves to opened state.

CRs-Fixed: 2009308
Change-Id: I73d2f7537e1ff2a4dd735e1af85473b64c2bf1ae
Arunk Khandavalli 8 gadi atpakaļ
vecāks
revīzija
67193d58e2
1 mainītis faili ar 33 papildinājumiem un 17 dzēšanām
  1. 33 17
      core/hdd/src/wlan_hdd_main.c

+ 33 - 17
core/hdd/src/wlan_hdd_main.c

@@ -1701,6 +1701,37 @@ static void hdd_disable_power_management(void)
 	hif_disable_power_management(hif_ctx);
 }
 
+/**
+ * hdd_update_hw_sw_info() - API to update the HW/SW information
+ *
+ * API to update the HW and SW information in the driver
+ *
+ * Return: None
+ */
+static void hdd_update_hw_sw_info(hdd_context_t *hdd_ctx)
+{
+	void *hif_sc;
+
+	hif_sc = cds_get_context(QDF_MODULE_ID_HIF);
+	if (!hif_sc) {
+		hdd_err("HIF context is NULL");
+		return;
+	}
+
+	/*
+	 * target hw version/revision would only be retrieved after firmware
+	 * download
+	 */
+	hif_get_hw_info(hif_sc, &hdd_ctx->target_hw_version,
+			&hdd_ctx->target_hw_revision,
+			&hdd_ctx->target_hw_name);
+
+	/* Get the wlan hw/fw version */
+	hdd_wlan_get_version(hdd_ctx, NULL, NULL);
+
+	return;
+}
+
 /**
  * hdd_wlan_start_modules() - Single driver state machine for starting modules
  * @hdd_ctx: HDD context
@@ -1813,6 +1844,8 @@ int hdd_wlan_start_modules(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter,
 			goto close;
 		}
 
+		hdd_update_hw_sw_info(hdd_ctx);
+
 		if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) {
 			sme_register_ftm_msg_processor(hdd_ctx->hHal,
 						       hdd_ftm_mc_process_msg);
@@ -8361,7 +8394,6 @@ int hdd_wlan_startup(struct device *dev)
 	QDF_STATUS status;
 	hdd_context_t *hdd_ctx;
 	int ret;
-	void *hif_sc;
 	bool rtnl_held;
 	int set_value;
 
@@ -8426,22 +8458,6 @@ int hdd_wlan_startup(struct device *dev)
 		goto err_release_rtnl_lock;
 	}
 
-	hif_sc = cds_get_context(QDF_MODULE_ID_HIF);
-	if (!hif_sc) {
-		hdd_err("HIF context is NULL");
-		goto err_close_adapters;
-	}
-	/*
-	 * target hw version/revision would only be retrieved after firmware
-	 * download
-	 */
-	hif_get_hw_info(hif_sc, &hdd_ctx->target_hw_version,
-			&hdd_ctx->target_hw_revision,
-			&hdd_ctx->target_hw_name);
-
-	/* Get the wlan hw/fw version */
-	hdd_wlan_get_version(hdd_ctx, NULL, NULL);
-
 	hdd_release_rtnl_lock();
 	rtnl_held = false;