diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 930c477a22b8..4826420ba6c0 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -20342,10 +20342,11 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, } /* - * Check if this is reassoc to same bssid, if reassoc is success, return + * Check if this is reassoc to same bssid, if reassoc is success or if + * roam invoke is not allowed, return the status */ status = wlan_hdd_reassoc_bssid_hint(adapter, req); - if (!status) + if (!status || status == -EPERM) return status; /* Try disconnecting if already in connected state */ diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index a2cd264e25c3..5b2ccdc36023 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -515,6 +515,32 @@ QDF_STATUS hdd_wma_send_fastreassoc_cmd(struct hdd_adapter *adapter, } #endif +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 9, 0)) +/** + * hdd_is_fast_reassoc_allowed - check if roaming offload init is + * done. If roaming offload is not initialized, don't allow roam invoke + * to be triggered. + * @psoc: Pointer to psoc object + * @vdev_id: vdev_id + * + * This API should return true if kernel version is less than 4.9, because + * the earlier versions don't have the fix to handle reassociation failure. + * + * Return: true if roaming module initialization is done else false + */ +static bool +hdd_is_fast_reassoc_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) +{ + return MLME_IS_ROAM_INITIALIZED(psoc, vdev_id); +} +#else +static inline bool +hdd_is_fast_reassoc_allowed(struct wlan_objmgr_psoc *psoc, uint8_t vdev_id) +{ + return true; +} +#endif + int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, uint32_t ch_freq, const handoff_src src) { @@ -573,6 +599,14 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, /* Proceed with reassoc */ if (roaming_offload_enabled(hdd_ctx)) { + if (!hdd_is_fast_reassoc_allowed(hdd_ctx->psoc, + adapter->vdev_id)) { + hdd_err("LFR3: vdev[%d] Roaming module is not initialized", + adapter->vdev_id); + ret = -EPERM; + goto exit; + } + status = hdd_wma_send_fastreassoc_cmd(adapter, bssid, ch_freq); if (status != QDF_STATUS_SUCCESS) { hdd_err("Failed to send fast reassoc cmd");