wlan: Address TDLS synchronization issues on p2p interface
TDLS timers created during p2p connection should be destroyed
as a part of p2p disconnect before p2p adapter's device mode
is changed to P2P_DEVICE from P2P_CLIENT as TDLS is supported
only in P2P_CLIENT and INFRA_STATION modes.
Due to the race between MCThread and Suplicant thread, On P2P
disconnection, cfg80211_change_iface function getting invoked
and changes the adapter mode to P2P_DEVICE before the tdls timers
are destroyed as a part of hdd_DisconnectionHandler in MCThread
context leading to timer leaks. As a result, timer functions
getting invoked after driver unload leading to kernel panic.
To mitigate this issue, destroy tdls timers also when change_iface
is called on p2p interface.
Change-Id: I54da52b95215538ce01176403d0b1f718b5520be
CRs-Fixed: 887265
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 28d472d..b684432 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -8236,6 +8236,11 @@
//Check for sub-string p2p to confirm its a p2p interface
if (NULL != strstr(ndev->name,"p2p"))
{
+#ifdef FEATURE_WLAN_TDLS
+ mutex_lock(&pHddCtx->tdls_lock);
+ wlan_hdd_tdls_exit(pAdapter, TRUE);
+ mutex_unlock(&pHddCtx->tdls_lock);
+#endif
pAdapter->device_mode = (type == NL80211_IFTYPE_STATION) ?
WLAN_HDD_P2P_DEVICE : WLAN_HDD_P2P_CLIENT;
}