Bläddra i källkod

qcacld-3.0: Fix memory leak in tdls module

TDLS init/exit functions have some dead code and it causes
memory leak for each wlan on/off operation.
Remove the dead code from TDLS init/exit functions.

Change-Id: Ie43057d94a27c34e970293b5cbc75edb6c0f6ca8
CRs-Fixed: 1050841
Kabilan Kannan 8 år sedan
förälder
incheckning
4446dddc3a
1 ändrade filer med 1 tillägg och 93 borttagningar
  1. 1 93
      core/hdd/src/wlan_hdd_tdls.c

+ 1 - 93
core/hdd/src/wlan_hdd_tdls.c

@@ -691,7 +691,6 @@ int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter)
 	tdlsCtx_t *pHddTdlsCtx;
 	int i;
 	uint8_t staIdx;
-	tdlsInfo_t *tInfo;
 
 	if (NULL == pHddCtx)
 		return -EINVAL;
@@ -823,55 +822,10 @@ int wlan_hdd_tdls_init(hdd_adapter_t *pAdapter)
 	INIT_DELAYED_WORK(&pHddCtx->tdls_scan_ctxt.tdls_scan_work,
 			  wlan_hdd_tdls_schedule_scan);
 
-	/*
-	 * Release tdls lock before calling in SME api
-	 * which would try to acquire sme lock.
-	 */
 	mutex_unlock(&pHddCtx->tdls_lock);
-	tInfo = qdf_mem_malloc(sizeof(tdlsInfo_t));
-	if (NULL == tInfo) {
-		hddLog(QDF_TRACE_LEVEL_ERROR,
-		       FL("qdf_mem_malloc failed for tInfo"));
-		qdf_mc_timer_destroy(&pHddTdlsCtx->peerDiscoveryTimeoutTimer);
-		qdf_mem_free(pHddTdlsCtx);
-		return -ENOMEM;
-	}
 
-	tInfo->vdev_id = pAdapter->sessionId;
-	tInfo->tdls_state = pHddCtx->tdls_mode;
-	tInfo->notification_interval_ms =
-		pHddTdlsCtx->threshold_config.tx_period_t;
-	tInfo->tx_discovery_threshold =
-		pHddTdlsCtx->threshold_config.tx_packet_n;
-	tInfo->tx_teardown_threshold =
-		pHddTdlsCtx->threshold_config.idle_packet_n;
-	tInfo->rssi_teardown_threshold =
-		pHddTdlsCtx->threshold_config.rssi_teardown_threshold;
-	tInfo->rssi_delta = pHddTdlsCtx->threshold_config.rssi_delta;
-	tInfo->tdls_options = 0;
-
-	if (pHddCtx->config->fEnableTDLSOffChannel) {
-		tInfo->tdls_options |= ENA_TDLS_OFFCHAN;
+	if (pHddCtx->config->fEnableTDLSOffChannel)
 		pHddCtx->tdls_fw_off_chan_mode = ENABLE_CHANSWITCH;
-	}
-
-	if (pHddCtx->config->fEnableTDLSBufferSta)
-		tInfo->tdls_options |= ENA_TDLS_BUFFER_STA;
-	if (pHddCtx->config->fEnableTDLSSleepSta)
-		tInfo->tdls_options |= ENA_TDLS_SLEEP_STA;
-	tInfo->peer_traffic_ind_window = pHddCtx->config->fTDLSPuapsdPTIWindow;
-	tInfo->peer_traffic_response_timeout =
-		pHddCtx->config->fTDLSPuapsdPTRTimeout;
-	tInfo->puapsd_mask = pHddCtx->config->fTDLSUapsdMask;
-	tInfo->puapsd_inactivity_time =
-		pHddCtx->config->fTDLSPuapsdInactivityTimer;
-	tInfo->puapsd_rx_frame_threshold =
-		pHddCtx->config->fTDLSRxFrameThreshold;
-	tInfo->teardown_notification_ms =
-		pHddCtx->config->tdls_idle_timeout;
-	tInfo->tdls_peer_kickout_threshold =
-		pHddCtx->config->tdls_peer_kickout_threshold;
-	dump_tdls_state_param_setting(tInfo);
 
 	EXIT();
 	return 0;
@@ -887,7 +841,6 @@ void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter)
 {
 	tdlsCtx_t *pHddTdlsCtx;
 	hdd_context_t *pHddCtx;
-	tdlsInfo_t *tInfo;
 
 	ENTER();
 	pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
@@ -928,51 +881,6 @@ void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter)
 
 	wlan_hdd_tdls_free_scan_request(&pHddCtx->tdls_scan_ctxt);
 
-	/* No need to post message during driver unlaod because MC thread is
-	   already shutdown */
-	if (!cds_is_driver_unloading()) {
-		tInfo = qdf_mem_malloc(sizeof(tdlsInfo_t));
-		if (NULL != tInfo) {
-			tInfo->vdev_id = pAdapter->sessionId;
-			tInfo->tdls_state = eTDLS_SUPPORT_DISABLED;
-			tInfo->notification_interval_ms =
-				pHddTdlsCtx->threshold_config.tx_period_t;
-			tInfo->tx_discovery_threshold =
-				pHddTdlsCtx->threshold_config.tx_packet_n;
-			tInfo->tx_teardown_threshold =
-				pHddTdlsCtx->threshold_config.idle_packet_n;
-			tInfo->rssi_teardown_threshold =
-				pHddTdlsCtx->threshold_config.
-				rssi_teardown_threshold;
-			tInfo->rssi_delta =
-				pHddTdlsCtx->threshold_config.rssi_delta;
-			tInfo->tdls_options = 0;
-			if (pHddCtx->config->fEnableTDLSOffChannel)
-				tInfo->tdls_options |= ENA_TDLS_OFFCHAN;
-			if (pHddCtx->config->fEnableTDLSBufferSta)
-				tInfo->tdls_options |= ENA_TDLS_BUFFER_STA;
-			if (pHddCtx->config->fEnableTDLSSleepSta)
-				tInfo->tdls_options |= ENA_TDLS_SLEEP_STA;
-			tInfo->peer_traffic_ind_window =
-				pHddCtx->config->fTDLSPuapsdPTIWindow;
-			tInfo->peer_traffic_response_timeout =
-				pHddCtx->config->fTDLSPuapsdPTRTimeout;
-			tInfo->puapsd_mask = pHddCtx->config->fTDLSUapsdMask;
-			tInfo->puapsd_inactivity_time =
-				pHddCtx->config->fTDLSPuapsdInactivityTimer;
-			tInfo->puapsd_rx_frame_threshold =
-				pHddCtx->config->fTDLSRxFrameThreshold;
-			tInfo->teardown_notification_ms =
-				pHddCtx->config->tdls_idle_timeout;
-			tInfo->tdls_peer_kickout_threshold =
-				pHddCtx->config->tdls_peer_kickout_threshold;
-			dump_tdls_state_param_setting(tInfo);
-		} else {
-			hddLog(QDF_TRACE_LEVEL_ERROR,
-			       "%s: qdf_mem_malloc failed for tInfo", __func__);
-		}
-	}
-
 	pHddTdlsCtx->magic = 0;
 	pHddTdlsCtx->pAdapter = NULL;