wlan: Fix for MC_Thread hung during change iface.
During change iface, driver is trying acquire a mutex lock
for tdls_lock before hdd_stop_adapter which is already held
by a tdls API running in wpa_supplicant thread causing the
MC_Thread to be blocked. To address this, accquire a mutex
only after stop adapter to avoid MC thread to be blocked.
Change-Id: If31fa2a7bdb6e07d347eb3d3065fb1fa969ff62a
CRs-Fixed: 706800
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 41e1367..f0db5af 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -6814,6 +6814,9 @@
//Fail to Exit BMPS
VOS_ASSERT(0);
}
+
+ hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE );
+
#ifdef FEATURE_WLAN_TDLS
/* A Mutex Lock is introduced while changing the mode to
@@ -6823,7 +6826,6 @@
mutex_lock(&pHddCtx->tdls_lock);
#endif
//De-init the adapter.
- hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE );
hdd_deinit_adapter( pHddCtx, pAdapter );
memset(&pAdapter->sessionCtx, 0, sizeof(pAdapter->sessionCtx));
pAdapter->device_mode = (type == NL80211_IFTYPE_AP) ?
@@ -6933,6 +6935,8 @@
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_ADHOC:
+
+ hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE );
#ifdef FEATURE_WLAN_TDLS
/* A Mutex Lock is introduced while changing the mode to
@@ -6941,7 +6945,6 @@
*/
mutex_lock(&pHddCtx->tdls_lock);
#endif
- hdd_stop_adapter( pHddCtx, pAdapter, VOS_TRUE );
hdd_deinit_adapter( pHddCtx, pAdapter );
wdev->iftype = type;
//Check for sub-string p2p to confirm its a p2p interface