From 90b48155a2cdd0fbf2957c2fc81cbc04e44e4c41 Mon Sep 17 00:00:00 2001 From: Ashish Date: Thu, 16 Dec 2021 23:03:32 +0530 Subject: [PATCH] qcacld-3.0: Address race between disconnect and system suspend A race between cfg80211 disconnect and wiphy system suspend can lead to either DPM WD or serialization VDEV disconnect active command timeout since scheduler thread gets suspended as part of wiphy suspend and both cfg80211_disconnect and wiphy suspend/resume acquire RTNL lock. To address this race condition avoid disconnect when wiphy suspend is already completed since scheduler thread gets suspended as part of wiphy suspend and it can't process vdev disconnect. Change-Id: Ia7e42cffb3f6b08b33c878b68122dbdc00bad251 CRs-Fixed: 3042442 --- core/hdd/src/wlan_hdd_cfg80211.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 69620c016b4c..1e07e2e47e2f 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -22067,15 +22067,21 @@ static int __wlan_hdd_cfg80211_disconnect(struct wiphy *wiphy, if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) return -EINVAL; + status = wlan_hdd_validate_context(hdd_ctx); + + if (status) + return status; + + if (hdd_ctx->is_wiphy_suspended) { + hdd_info_rl("wiphy is suspended retry disconnect"); + return -EAGAIN; + } + qdf_mtrace(QDF_MODULE_ID_HDD, QDF_MODULE_ID_HDD, TRACE_CODE_HDD_CFG80211_DISCONNECT, adapter->vdev_id, reason); hdd_print_netdev_txq_status(dev); - status = wlan_hdd_validate_context(hdd_ctx); - - if (0 != status) - return status; qdf_mutex_acquire(&adapter->disconnection_status_lock); if (adapter->disconnection_in_progress) {