Commit a100885d authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Luciano Coelho

wl12xx: avoid blocking while holding rcu lock on bss info change

Some blocking functions were called while holding the rcu lock for
accessing STA information. This can lead to a deadlock.

Save the required info beforehand and release the rcu without
blocking.
Signed-off-by: default avatarArik Nemtsov <arik@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 92fe9b5f
...@@ -2222,6 +2222,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -2222,6 +2222,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
u32 sta_rate_set = 0; u32 sta_rate_set = 0;
int ret; int ret;
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
bool sta_exists = false;
struct ieee80211_sta_ht_cap sta_ht_cap;
if (is_ibss) { if (is_ibss) {
ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf, ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf,
...@@ -2293,16 +2295,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -2293,16 +2295,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (sta->ht_cap.ht_supported) if (sta->ht_cap.ht_supported)
sta_rate_set |= sta_rate_set |=
(sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET); (sta->ht_cap.mcs.rx_mask[0] << HW_HT_RATES_OFFSET);
sta_ht_cap = sta->ht_cap;
sta_exists = true;
}
rcu_read_unlock();
if (sta_exists) {
/* handle new association with HT and HT information change */ /* handle new association with HT and HT information change */
if ((changed & BSS_CHANGED_HT) && if ((changed & BSS_CHANGED_HT) &&
(bss_conf->channel_type != NL80211_CHAN_NO_HT)) { (bss_conf->channel_type != NL80211_CHAN_NO_HT)) {
ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, ret = wl1271_acx_set_ht_capabilities(wl, &sta_ht_cap,
true); true);
if (ret < 0) { if (ret < 0) {
wl1271_warning("Set ht cap true failed %d", wl1271_warning("Set ht cap true failed %d",
ret); ret);
rcu_read_unlock();
goto out; goto out;
} }
ret = wl1271_acx_set_ht_information(wl, ret = wl1271_acx_set_ht_information(wl,
...@@ -2310,23 +2316,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -2310,23 +2316,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (ret < 0) { if (ret < 0) {
wl1271_warning("Set ht information failed %d", wl1271_warning("Set ht information failed %d",
ret); ret);
rcu_read_unlock();
goto out; goto out;
} }
} }
/* handle new association without HT and disassociation */ /* handle new association without HT and disassociation */
else if (changed & BSS_CHANGED_ASSOC) { else if (changed & BSS_CHANGED_ASSOC) {
ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, ret = wl1271_acx_set_ht_capabilities(wl, &sta_ht_cap,
false); false);
if (ret < 0) { if (ret < 0) {
wl1271_warning("Set ht cap false failed %d", wl1271_warning("Set ht cap false failed %d",
ret); ret);
rcu_read_unlock();
goto out; goto out;
} }
} }
} }
rcu_read_unlock();
if ((changed & BSS_CHANGED_ASSOC)) { if ((changed & BSS_CHANGED_ASSOC)) {
if (bss_conf->assoc) { if (bss_conf->assoc) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment