summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/hdd/src/wlan_hdd_tdls.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/core/hdd/src/wlan_hdd_tdls.c b/core/hdd/src/wlan_hdd_tdls.c
index 9ef07db17592..77a560d04979 100644
--- a/core/hdd/src/wlan_hdd_tdls.c
+++ b/core/hdd/src/wlan_hdd_tdls.c
@@ -874,22 +874,34 @@ void wlan_hdd_tdls_exit(hdd_adapter_t *pAdapter)
mutex_lock(&pHddCtx->tdls_lock);
+ pHddTdlsCtx = WLAN_HDD_GET_TDLS_CTX_PTR(pAdapter);
+ if (NULL == pHddTdlsCtx) {
+ /*
+ * TDLS context can be null and might have been freed up during
+ * cleanup for STA adapter
+ */
+ mutex_unlock(&pHddCtx->tdls_lock);
+
+ hdd_info("pHddTdlsCtx is NULL, adapter device mode: %s(%d)",
+ hdd_device_mode_to_string(pAdapter->device_mode),
+ pAdapter->device_mode);
+ goto done;
+ }
+
/* must stop timer here before freeing peer list, because peerIdleTimer is
part of peer list structure. */
wlan_hdd_tdls_timers_destroy(pHddTdlsCtx);
wlan_hdd_tdls_free_list(pHddTdlsCtx);
- mutex_unlock(&pHddCtx->tdls_lock);
-
wlan_hdd_tdls_free_scan_request(&pHddCtx->tdls_scan_ctxt);
pHddTdlsCtx->magic = 0;
pHddTdlsCtx->pAdapter = NULL;
-
- qdf_mem_free(pHddTdlsCtx);
pAdapter->sessionCtx.station.pHddTdlsCtx = NULL;
- pHddTdlsCtx = NULL;
+ mutex_unlock(&pHddCtx->tdls_lock);
+
+ qdf_mem_free(pHddTdlsCtx);
done:
EXIT();
clear_bit(TDLS_INIT_DONE, &pAdapter->event_flags);