Procházet zdrojové kódy

qcacld-3.0: Cleanup previous ap beacon ap ie info correctly

Currently host driver does not cleanup previous ap beacon ie
info if it does not support 11AX, which is leading to memleak.

To address above issue, free previous ap beacon ie info
irrespective of 11AX support.

Change-Id: Ia96e4790a7b6fc8805272367ef7aee985ef931b1
CRs-Fixed: 3258173
Ashish Kumar Dhanotiya před 2 roky
rodič
revize
765b3a80ee
2 změnil soubory, kde provedl 55 přidání a 24 odebrání
  1. 0 19
      core/hdd/inc/wlan_hdd_main.h
  2. 55 5
      core/hdd/src/wlan_hdd_main.c

+ 0 - 19
core/hdd/inc/wlan_hdd_main.h

@@ -4396,8 +4396,6 @@ static inline bool hdd_nbuf_dst_addr_is_self_addr(struct hdd_adapter *adapter,
 				    QDF_NBUF_DEST_MAC_OFFSET);
 }
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) && \
-     defined(WLAN_FEATURE_11AX)
 /**
  * hdd_cleanup_conn_info() - Cleanup connectin info
  * @adapter: Adapter upon which the command was received
@@ -4408,23 +4406,6 @@ static inline bool hdd_nbuf_dst_addr_is_self_addr(struct hdd_adapter *adapter,
  * Return: none
  */
 void hdd_cleanup_conn_info(struct hdd_adapter *adapter);
-/**
- * hdd_sta_destroy_ctx_all() - cleanup all station contexts
- * @hdd_ctx: Global HDD context
- *
- * This function destroys all the station contexts
- *
- * Return: none
- */
-void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx);
-#else
-static inline void hdd_cleanup_conn_info(struct hdd_adapter *adapter)
-{
-}
-static inline void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx)
-{
-}
-#endif
 
 #ifdef FEATURE_WLAN_RESIDENT_DRIVER
 extern char *country_code;

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

@@ -6637,19 +6637,56 @@ void hdd_deinit_adapter(struct hdd_context *hdd_ctx,
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 19, 0)) && \
      defined(WLAN_FEATURE_11AX)
-void hdd_cleanup_conn_info(struct hdd_adapter *adapter)
+/**
+ * hdd_cleanup_he_operation_info() - cleanup he operation info
+ * @adapter: Adapter structure
+ *
+ * This function destroys he operation information
+ *
+ * Return: none
+ */
+static void hdd_cleanup_he_operation_info(struct hdd_adapter *adapter)
 {
 	struct hdd_station_ctx *hdd_sta_ctx =
 					WLAN_HDD_GET_STATION_CTX_PTR(adapter);
-	struct element_info *bcn_ie;
 
-	if (!hdd_sta_ctx)
+	if (!hdd_sta_ctx) {
+		hdd_err("sta ctx in NULL");
 		return;
+	}
+	hdd_debug("cleanup he operation info");
 
 	if (hdd_sta_ctx->cache_conn_info.he_operation) {
 		qdf_mem_free(hdd_sta_ctx->cache_conn_info.he_operation);
 		hdd_sta_ctx->cache_conn_info.he_operation = NULL;
 	}
+}
+#else
+static inline void hdd_cleanup_he_operation_info(struct hdd_adapter *adapter)
+{
+}
+#endif
+
+/**
+ * hdd_cleanup_prev_ap_bcn_ie() - cleanup previous ap beacon ie
+ * @adapter: Adapter structure
+ *
+ * This function destroys previous ap beacon information
+ *
+ * Return: none
+ */
+static void hdd_cleanup_prev_ap_bcn_ie(struct hdd_adapter *adapter)
+{
+	struct hdd_station_ctx *hdd_sta_ctx =
+					WLAN_HDD_GET_STATION_CTX_PTR(adapter);
+	struct element_info *bcn_ie;
+
+	if (!hdd_sta_ctx) {
+		hdd_err("sta ctx in NULL");
+		return;
+	}
+	hdd_debug("cleanup previous ap bcn ie");
+
 	bcn_ie = &hdd_sta_ctx->conn_info.prev_ap_bcn_ie;
 
 	if (bcn_ie->ptr) {
@@ -6659,7 +6696,21 @@ void hdd_cleanup_conn_info(struct hdd_adapter *adapter)
 	}
 }
 
-void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx)
+void hdd_cleanup_conn_info(struct hdd_adapter *adapter)
+{
+	hdd_cleanup_he_operation_info(adapter);
+	hdd_cleanup_prev_ap_bcn_ie(adapter);
+}
+
+/**
+ * hdd_sta_destroy_ctx_all() - cleanup all station contexts
+ * @hdd_ctx: Global HDD context
+ *
+ * This function destroys all the station contexts
+ *
+ * Return: none
+ */
+static void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx)
 {
 	struct hdd_adapter *adapter, *next_adapter = NULL;
 
@@ -6671,7 +6722,6 @@ void hdd_sta_destroy_ctx_all(struct hdd_context *hdd_ctx)
 					  NET_DEV_HOLD_STA_DESTROY_CTX_ALL);
 	}
 }
-#endif
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 12, 0)
 static void