qcacld-3.0: Clear privacy settings if concurrency check fails

Before STA connection starts, privacy settings are imposed to
HDD layer and then checked against concurrency settings. But
when the check for privacy/concurrency fails, the previously
populated privacy settings are not cleared because the CSR
roaming state machine doesn't goto privacy setting clearing
stage under such circumstances.

Add API to clear the privacy settings in HDD layer when
privacy checking against concurrency fails, so that old
privacy settings will not interfere with new settings when
connection starts next time.

Change-Id: Ic8eb28def3839195301e9bbb358f876dc3d46642
CRs-Fixed: 2274858
This commit is contained in:
wadesong 2018-08-06 13:26:27 +08:00 committed by nshrivas
parent 3fa5cba537
commit caad7c70bc

View File

@ -19309,6 +19309,60 @@ static int wlan_hdd_cfg80211_set_privacy(struct hdd_adapter *adapter,
return status;
}
/**
* wlan_hdd_clear_wapi_privacy() - reset WAPI settings in HDD layer
* @adapter: pointer to HDD adapter object
*
* This function resets all WAPI related parameters imposed before STA
* connection starts. It's invoked when privacy checking against concurrency
* fails, to make sure no improper WAPI settings are still populated before
* returning an error to the upper layer requester.
*
* Return: none
*/
#ifdef FEATURE_WLAN_WAPI
static inline void wlan_hdd_clear_wapi_privacy(struct hdd_adapter *adapter)
{
adapter->wapi_info.wapi_mode = 0;
adapter->wapi_info.wapi_auth_mode = WAPI_AUTH_MODE_OPEN;
}
#else
static inline void wlan_hdd_clear_wapi_privacy(struct hdd_adapter *adapter)
{
}
#endif
/**
* wlan_hdd_cfg80211_clear_privacy() - reset STA security parameters
* @adapter: pointer to HDD adapter object
*
* This function resets all privacy related parameters imposed
* before STA connection starts. It's invoked when privacy checking
* against concurrency fails, to make sure no improper settings are
* still populated before returning an error to the upper layer requester.
*
* Return: none
*/
static void wlan_hdd_cfg80211_clear_privacy(struct hdd_adapter *adapter)
{
struct hdd_station_ctx *hdd_sta_ctx =
WLAN_HDD_GET_STATION_CTX_PTR(adapter);
hdd_debug("resetting all privacy configurations");
hdd_sta_ctx->wpa_versions = 0;
hdd_sta_ctx->conn_info.authType = eCSR_AUTH_TYPE_NONE;
hdd_sta_ctx->roam_profile.AuthType.authType[0] = eCSR_AUTH_TYPE_NONE;
hdd_sta_ctx->conn_info.ucEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
hdd_sta_ctx->roam_profile.EncryptionType.numEntries = 0;
hdd_sta_ctx->conn_info.mcEncryptionType = eCSR_ENCRYPT_TYPE_NONE;
hdd_sta_ctx->roam_profile.mcEncryptionType.numEntries = 0;
wlan_hdd_clear_wapi_privacy(adapter);
}
int wlan_hdd_try_disconnect(struct hdd_adapter *adapter)
{
unsigned long rc;
@ -19661,14 +19715,16 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
adapter->device_mode),
req->channel->hw_value, HW_MODE_20_MHZ)) {
hdd_warn("This concurrency combination is not allowed");
return -ECONNREFUSED;
status = -ECONNREFUSED;
goto con_chk_failed;
}
} else {
if (!policy_mgr_allow_concurrency(hdd_ctx->hdd_psoc,
policy_mgr_convert_device_mode_to_qdf_type(
adapter->device_mode), 0, HW_MODE_20_MHZ)) {
hdd_warn("This concurrency combination is not allowed");
return -ECONNREFUSED;
status = -ECONNREFUSED;
goto con_chk_failed;
}
}
@ -19684,8 +19740,11 @@ static int __wlan_hdd_cfg80211_connect(struct wiphy *wiphy,
bssid_hint, channel, 0);
if (0 > status) {
hdd_err("connect failed");
return status;
}
return status;
con_chk_failed:
wlan_hdd_cfg80211_clear_privacy(adapter);
hdd_exit();
return status;
}