Browse Source

qcacld-3.0: Cleanup active links conn info on close adapter

Iterate all active links for cleaning up connection info
on close adapter to avoid memory leaks.

Change-Id: Ib3dc11d67dd023104a2289409257c29d2dd8cb14
CRs-Fixed: 3524046
Vinod Kumar Pirla 2 years ago
parent
commit
361d3775af
1 changed files with 13 additions and 4 deletions
  1. 13 4
      core/hdd/src/wlan_hdd_main.c

+ 13 - 4
core/hdd/src/wlan_hdd_main.c

@@ -7566,11 +7566,16 @@ void hdd_cleanup_conn_info(struct wlan_hdd_link_info *link_info)
 static void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
+	struct wlan_hdd_link_info *link_info;
 
 	hdd_for_each_adapter_dev_held_safe(hdd_ctx, adapter, next_adapter,
 					   NET_DEV_HOLD_STA_DESTROY_CTX_ALL) {
-		if (adapter->device_mode == QDF_STA_MODE)
-			hdd_cleanup_conn_info(adapter->deflink);
+		if (adapter->device_mode == QDF_STA_MODE) {
+			hdd_adapter_for_each_active_link_info(adapter,
+							      link_info) {
+				hdd_cleanup_conn_info(link_info);
+			}
+		}
 		hdd_adapter_dev_put_debug(adapter,
 					  NET_DEV_HOLD_STA_DESTROY_CTX_ALL);
 	}
@@ -8477,10 +8482,14 @@ static void __hdd_close_adapter(struct hdd_context *hdd_ctx,
 				bool rtnl_held)
 {
 	struct qdf_mac_addr adapter_mac;
+	struct wlan_hdd_link_info *link_info;
+
 
 	qdf_copy_macaddr(&adapter_mac, &adapter->mac_addr);
-	if (adapter->device_mode == QDF_STA_MODE)
-		hdd_cleanup_conn_info(adapter->deflink);
+	if (adapter->device_mode == QDF_STA_MODE) {
+		hdd_adapter_for_each_active_link_info(adapter, link_info)
+			hdd_cleanup_conn_info(link_info);
+	}
 	qdf_list_destroy(&adapter->blocked_scan_request_q);
 	qdf_mutex_destroy(&adapter->blocked_scan_request_q_lock);
 	policy_mgr_clear_concurrency_mode(hdd_ctx->psoc, adapter->device_mode);