From 4c9b675e2f165732f45513fc0d0eec8a683e2a23 Mon Sep 17 00:00:00 2001 From: Rajeev Kumar Sirasanagandla Date: Tue, 25 Jul 2017 20:35:20 +0530 Subject: [PATCH] qcacld-3.0: Avoid auto phy mode for ini specific band When specific band is set from ini file and if user is trying to change phy mode to auto with iwpriv command, crash is seen. To fix this, avoid eCSR_DOT11_MODE_AUTO when BandCapability is set. Change-Id: Ieaaa1dddfafbed2fdf51b7c924977b02077f01b6 CRs-Fixed: 2082166 --- core/hdd/src/wlan_hdd_wext.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 3b0031071a18..1c206ef31e39 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -7784,12 +7784,18 @@ int wlan_hdd_update_phymode(struct net_device *net, tHalHandle hal, retval = -EIO; goto free; } - if (phddctx->config->nChannelBondingMode5GHz) - phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]->ht_cap.cap - |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; - else - phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]->ht_cap.cap - &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; + + if (band_5g) { + struct ieee80211_supported_band *band; + + band = phddctx->wiphy->bands[HDD_NL80211_BAND_5GHZ]; + if (phddctx->config->nChannelBondingMode5GHz) + band->ht_cap.cap |= + IEEE80211_HT_CAP_SUP_WIDTH_20_40; + else + band->ht_cap.cap &= + ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; + } hdd_debug("New_Phymode= %d ch_bonding=%d band=%d VHT_ch_width=%u", phymode, chwidth, curr_band, vhtchanwidth); @@ -12755,7 +12761,8 @@ int hdd_reg_set_band(struct net_device *dev, u8 ui_band) hdd_debug("change band to %u", band); if ((band == BAND_2G && hdd_ctx->config->nBandCapability == 2) || - (band == BAND_5G && hdd_ctx->config->nBandCapability == 1)) { + (band == BAND_5G && hdd_ctx->config->nBandCapability == 1) || + (band == BAND_ALL && hdd_ctx->config->nBandCapability != 0)) { hdd_err("band value %u violate INI settings %u", band, hdd_ctx->config->nBandCapability); return -EIO;