Browse Source

qcacld-3.0: Move the freeing of tartget memory module_exit to stop_modules

In the Loadonce unload never driver the modules_start and modules_stop
happen multiple times and presently the memory for target_name is
allocated multiple times during the start_modules but freed only
once during the module_exit, so when the driver is unloaded
this can result in  a crash.

Moving this to stop_modules will help in freeing this everytimg.

Change-Id: I87a92c8b411fb0ae148a293d74e6914246b88014
CRs-Fixed: 2107392
Arunk Khandavalli 7 years ago
parent
commit
4b404333ca
1 changed files with 5 additions and 2 deletions
  1. 5 2
      core/hdd/src/wlan_hdd_main.c

+ 5 - 2
core/hdd/src/wlan_hdd_main.c

@@ -6072,8 +6072,6 @@ static void hdd_wlan_exit(struct hdd_context *hdd_ctx)
 	if (driver_status)
 		hdd_err("Psoc delete failed");
 
-	qdf_mem_free(hdd_ctx->target_hw_name);
-
 	hdd_context_destroy(hdd_ctx);
 }
 
@@ -9493,6 +9491,11 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode)
 
 	hdd_runtime_suspend_context_deinit(hdd_ctx);
 
+	if (hdd_ctx->target_hw_name) {
+		qdf_mem_free(hdd_ctx->target_hw_name);
+		hdd_ctx->target_hw_name = NULL;
+	}
+
 	hdd_hif_close(hdd_ctx, hif_ctx);
 
 	ol_cds_free();