summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h1
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index c9db52a7bbdc..ba12da36ab51 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -109,6 +109,7 @@
/** Maximum time(ms)to wait for disconnect to complete **/
#define WLAN_WAIT_TIME_DISCONNECT 5000
+#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
#define WLAN_WAIT_TIME_STATS 800
#define WLAN_WAIT_TIME_POWER 800
#define WLAN_WAIT_TIME_COUNTRY 1000
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 03fd12441371..699f073cec63 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -24203,6 +24203,7 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
eConnectionState prev_conn_state;
+ uint32_t wait_time = WLAN_WAIT_TIME_DISCONNECT;
ENTER();
@@ -24230,7 +24231,15 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
hddLog(LOG1,
FL("status = %d, already disconnected"), status);
result = 0;
- goto disconnected;
+ /*
+ * Wait here instead of returning directly. This will block the
+ * next connect command and allow processing of the disconnect
+ * in SME else we might hit some race conditions leading to SME
+ * and HDD out of sync. As disconnect is already in progress,
+ * wait here for 1 sec instead of 5 sec.
+ */
+ wait_time = WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS;
+ goto wait_for_disconnect;
}
/*
* Wait here instead of returning directly, this will block the next
@@ -24249,9 +24258,10 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
result = -EINVAL;
goto disconnected;
}
+wait_for_disconnect:
rc = wait_for_completion_timeout(
&pAdapter->disconnect_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+ msecs_to_jiffies(wait_time));
if (!rc && (eHAL_STATUS_CMD_NOT_QUEUED != status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,