From 75af0a6c04c9c609b5d6e1bb71a324cc0fef19ce Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Tue, 8 May 2018 17:08:54 +0530 Subject: [PATCH] qcacld-3.0: Fix return status in wlan_hdd_reassoc_bssid_hint Currently wlan_hdd_reassoc_bssid_hint returns true if prev_bssid is present in the connect request even if the hdd_reassoc fails leading to connection not happening if the supplicant sends a prev_bssid and bssid_hint in the connect request and if the current state is not connected. Fix return status in __wlan_hdd_cfg80211_connect to return 0 only if hdd_reassoc is success else proceed with disconnect and connect Change-Id: I513495797f2538fc8887ff0a9ce04e13035e0549 CRs-Fixed: 2238104 --- core/hdd/src/wlan_hdd_cfg80211.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 495de7d64044..edb95e2fba53 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -19309,20 +19309,18 @@ disconnected: * wlan_hdd_reassoc_bssid_hint() - Start reassociation if bssid is present * @adapter: Pointer to the HDD adapter * @req: Pointer to the structure cfg_connect_params receieved from user space - * @status: out variable for status of reassoc request * * This function will start reassociation if prev_bssid is set and bssid/ * bssid_hint, channel/channel_hint parameters are present in connect request. * - * Return: true if connect was for ReAssociation, false otherwise + * Return: 0 if connect was for ReAssociation, non-zero error code otherwise */ #if defined(CFG80211_CONNECT_PREV_BSSID) || \ (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)) -static bool wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, - struct cfg80211_connect_params *req, - int *status) +static int wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, + struct cfg80211_connect_params *req) { - bool reassoc = false; + int status = -EINVAL; const uint8_t *bssid = NULL; uint16_t channel = 0; struct hdd_station_ctx *sta_ctx; @@ -19338,7 +19336,6 @@ static bool wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, channel = req->channel_hint->hw_value; if (bssid && channel && req->prev_bssid) { - reassoc = true; hdd_debug("REASSOC Attempt on channel %d to " MAC_ADDRESS_STR, channel, MAC_ADDR_ARRAY(bssid)); /* @@ -19351,18 +19348,17 @@ static bool wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, qdf_mem_copy(sta_ctx->requested_bssid.bytes, bssid, QDF_MAC_ADDR_SIZE); - *status = hdd_reassoc(adapter, bssid, channel, + status = hdd_reassoc(adapter, bssid, channel, CONNECT_CMD_USERSPACE); - hdd_debug("hdd_reassoc: status: %d", *status); + hdd_debug("hdd_reassoc: status: %d", status); } - return reassoc; + return status; } #else -static bool wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, - struct cfg80211_connect_params *req, - int *status) +static int wlan_hdd_reassoc_bssid_hint(struct hdd_adapter *adapter, + struct cfg80211_connect_params *req) { - return false; + return -ENOTSUPP; } #endif @@ -19488,7 +19484,11 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy, return -EINVAL; } - if (true == wlan_hdd_reassoc_bssid_hint(adapter, req, &status)) + /* + * Check if this is reassoc to same bssid, if reassoc is success, return + */ + status = wlan_hdd_reassoc_bssid_hint(adapter, req); + if (!status) return status; /* Try disconnecting if already in connected state */