Kaynağa Gözat

qcacld-3.0: Fix WoW Pattern mem leak on unload

WoW patterns are maintained in an internal cache that is not cleaned
when the WLAN module is unloaded. Free the WoW pattern cache as part
of the WLAN module unload.

Change-Id: I1ebd1876555d01551542f7029f53a72af6773dbc
CRs-Fixed: 2044774
Dustin Brown 8 yıl önce
ebeveyn
işleme
edce4a571e

+ 4 - 6
core/hdd/inc/wlan_hdd_wowl.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -172,12 +172,10 @@ bool hdd_enter_wowl(hdd_adapter_t *pAdapter, bool enable_mp, bool enable_pbm);
 bool hdd_exit_wowl(hdd_adapter_t *pAdapter);
 
 /**
- * hdd_init_wowl() - Init function which will initialize the WoWL module
- *		     and perform any required initial configuration
- * @pAdapter: pointer to the adapter
+ * hdd_deinit_wowl() - Deinit function to cleanup WoWL allocated memory
  *
- * Return: false if any errors encountered, true otherwise
+ * Return: None
  */
-bool hdd_init_wowl(hdd_adapter_t *pAdapter);
+void hdd_deinit_wowl(void);
 
 #endif /* #ifndef _WLAN_HDD_WOWL_H */

+ 1 - 8
core/hdd/src/wlan_hdd_main.c

@@ -3735,12 +3735,6 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
 		policy_mgr_set_concurrency_mode(hdd_ctx->hdd_psoc,
 			session_type);
 
-		/* Initialize the WoWL service */
-		if (!hdd_init_wowl(adapter)) {
-			hdd_err("hdd_init_wowl failed");
-			goto err_close_adapter;
-		}
-
 		/* Adapter successfully added. Increment the vdev count */
 		hdd_ctx->current_intf_count++;
 
@@ -3755,8 +3749,6 @@ hdd_adapter_t *hdd_open_adapter(hdd_context_t *hdd_ctx, uint8_t session_type,
 
 	return adapter;
 
-err_close_adapter:
-	hdd_close_adapter(hdd_ctx, adapter, rtnl_held);
 err_free_netdev:
 	wlan_hdd_release_intf_addr(hdd_ctx, adapter->macAddressCurrent.bytes);
 	free_netdev(adapter->dev);
@@ -10213,6 +10205,7 @@ err_out:
  */
 void hdd_deinit(void)
 {
+	hdd_deinit_wowl();
 	cds_deinit();
 
 #ifdef WLAN_LOGGING_SOCK_SVC_ENABLE

+ 8 - 17
core/hdd/src/wlan_hdd_wowl.c

@@ -539,23 +539,14 @@ bool hdd_exit_wowl(hdd_adapter_t *pAdapter)
 	return true;
 }
 
-/**
- * hdd_init_wowl() - Init function which will initialize the WoWL module
- *		     and perform any required initial configuration
- * @pAdapter: pointer to the adapter
- *
- * Return: false if any errors encountered, true otherwise
- */
-bool hdd_init_wowl(hdd_adapter_t *pAdapter)
+void hdd_deinit_wowl(void)
 {
-	hdd_context_t *pHddCtx = NULL;
-	pHddCtx = pAdapter->pHddCtx;
-
-	memset(g_hdd_wowl_ptrns, 0, sizeof(g_hdd_wowl_ptrns));
-	g_hdd_wowl_ptrns_count = 0;
-
-	/* Add any statically configured patterns */
-	hdd_add_wowl_ptrn(pAdapter, pHddCtx->config->wowlPattern);
+	int i;
 
-	return true;
+	for (i = 0; i < WOWL_MAX_PTRNS_ALLOWED; ++i) {
+		if (g_hdd_wowl_ptrns[i]) {
+			qdf_mem_free(g_hdd_wowl_ptrns[i]);
+			g_hdd_wowl_ptrns[i] = NULL;
+		}
+	}
 }