Procházet zdrojové kódy

qcacld-3.0: Fix the pdev reference leak during unload

WMA pdev reference clear is called after the wma close hence
wma handle is NULL and pdev refernce is not cleared.
Clear the pdev reference during WMA close procedure

Change-Id: I6c4caa21e9329f5d7542d114763cd6ae8931a604
CRs-Fixed: 2008013
Kiran Kumar Lokere před 8 roky
rodič
revize
f089a3a738

+ 0 - 1
core/hdd/src/wlan_hdd_object_manager.c

@@ -134,7 +134,6 @@ int hdd_objmgr_release_and_destroy_pdev(hdd_context_t *hdd_ctx)
 
 	hdd_deinit_pdev_os_priv(hdd_ctx);
 	hdd_ctx->hdd_pdev = NULL;
-	sme_clear_pdev(hdd_ctx->hHal);
 	if (!pdev)
 		return -EINVAL;
 

+ 4 - 0
core/mac/src/sys/legacy/src/system/src/mac_init_api.c

@@ -182,6 +182,10 @@ tSirRetStatus mac_close(tHalHandle hHal)
 	/* Call routine to free-up all CFG data structures */
 	cfg_de_init(pMac);
 
+	if (pMac->pdev) {
+		wlan_objmgr_pdev_release_ref(pMac->pdev, WLAN_LEGACY_MAC_ID);
+		pMac->pdev = NULL;
+	}
 	wlan_objmgr_psoc_release_ref(pMac->psoc, WLAN_LEGACY_MAC_ID);
 	pMac->psoc = NULL;
 	/* Finally, de-allocate the global MAC datastructure: */

+ 0 - 7
core/sme/inc/sme_api.h

@@ -1478,11 +1478,4 @@ QDF_STATUS sme_register_set_connection_info_cb(tHalHandle hHal,
  */
 void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev);
 
-/**
- * sme_clear_pdev() - clear pdev
- * @hal - MAC global handle
- *
- * Return: QDF_STATUS
- */
-void sme_clear_pdev(tHalHandle hal);
 #endif /* #if !defined( __SME_API_H ) */

+ 2 - 19
core/sme/src/common/sme_api.c

@@ -16150,7 +16150,7 @@ void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev)
 	void *wma_handle;
 	QDF_STATUS status;
 
-	status = wlan_objmgr_pdev_try_get_ref(pdev, WLAN_LEGACY_SME_ID);
+	status = wlan_objmgr_pdev_try_get_ref(pdev, WLAN_LEGACY_MAC_ID);
 	if (QDF_STATUS_SUCCESS != status) {
 		mac_ctx->pdev = NULL;
 		return;
@@ -16159,26 +16159,9 @@ void sme_store_pdev(tHalHandle hal, struct wlan_objmgr_pdev *pdev)
 	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
 	if (!wma_handle) {
 		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				"wma handle is NULL");
+				FL("wma handle is NULL"));
 		return;
 	}
 	wma_store_pdev(wma_handle, pdev);
 }
 
-void sme_clear_pdev(tHalHandle hal)
-{
-	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
-	void *wma_handle;
-
-	if (mac_ctx->pdev) {
-		wlan_objmgr_pdev_release_ref(mac_ctx->pdev, WLAN_LEGACY_SME_ID);
-		mac_ctx->pdev = NULL;
-	}
-	wma_handle = cds_get_context(QDF_MODULE_ID_WMA);
-	if (!wma_handle) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				"wma handle is NULL");
-		return;
-	}
-	wma_clear_pdev(wma_handle);
-}

+ 0 - 8
core/wma/inc/wma_api.h

@@ -296,12 +296,4 @@ static inline void wma_tx_failure_cb(void *ctx, uint32_t num_msdu,
  */
 void wma_store_pdev(void *wma_ctx, struct wlan_objmgr_pdev *pdev);
 
-/**
- * wma_clear_pdev() - clear pdev
- * @wma_ctx:	wma context
- *
- * Return: void
- */
-void wma_clear_pdev(void *wma_ctx);
-
 #endif

+ 0 - 9
core/wma/src/wma_dev_if.c

@@ -4721,12 +4721,3 @@ void wma_store_pdev(void *wma_ctx, struct wlan_objmgr_pdev *pdev)
 	wma->pdev = pdev;
 }
 
-void wma_clear_pdev(void *wma_ctx)
-{
-	tp_wma_handle wma = (tp_wma_handle)wma_ctx;
-
-	if (wma->pdev) {
-		wlan_objmgr_pdev_release_ref(wma->pdev, WLAN_LEGACY_WMA_ID);
-		wma->pdev = NULL;
-	}
-}

+ 5 - 1
core/wma/src/wma_main.c

@@ -3655,7 +3655,11 @@ QDF_STATUS wma_close(void *cds_ctx)
 	}
 
 	wma_ndp_unregister_all_event_handlers(wma_handle);
-
+	if (wma_handle->pdev) {
+		wlan_objmgr_pdev_release_ref(wma_handle->pdev,
+				WLAN_LEGACY_WMA_ID);
+		wma_handle->pdev = NULL;
+	}
 	wlan_objmgr_psoc_release_ref(wma_handle->psoc, WLAN_LEGACY_WMA_ID);
 	wma_handle->psoc = NULL;
 	target_if_close();