Jelajahi Sumber

qcacld-3.0: Fix memory leak when cds_pre_enable fails

runtime lock/pdev/pdev object are allocated when receive
rx ready event. If cdp_pdev_post_attach fails in cds_pre_enable,
such resources are also needed to release.

Change-Id: I549567d1125ce3b28c0ce6f3a9bda62e6209be09
CRs-Fixed: 2222363
Jingxiang Ge 7 tahun lalu
induk
melakukan
95912f8be5
1 mengubah file dengan 9 tambahan dan 2 penghapusan
  1. 9 2
      core/hdd/src/wlan_hdd_main.c

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

@@ -2621,6 +2621,7 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
 	QDF_STATUS status;
 	bool unint = false;
 	void *hif_ctx;
+	struct target_psoc_info *tgt_hdl;
 
 	hdd_debug("state:%d reinit:%d", hdd_ctx->driver_status, reinit);
 
@@ -2798,10 +2799,16 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx,
 
 post_disable:
 	cds_post_disable();
-	dispatcher_pdev_close(hdd_ctx->hdd_pdev);
-	hdd_objmgr_release_and_destroy_pdev(hdd_ctx);
 
 cds_txrx_free:
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(hdd_ctx->hdd_psoc);
+
+	if (tgt_hdl && target_psoc_get_wmi_ready(tgt_hdl)) {
+		hdd_runtime_suspend_context_deinit(hdd_ctx);
+		dispatcher_pdev_close(hdd_ctx->hdd_pdev);
+		hdd_objmgr_release_and_destroy_pdev(hdd_ctx);
+	}
+
 	cds_dp_close(hdd_ctx->hdd_psoc);
 
 close: