* [PATCH] wl12xx: lock the RCU when accessing sta via ieee80211_find_sta()
@ 2011-01-11 18:07 coelho
2011-01-13 11:33 ` Luciano Coelho
0 siblings, 1 reply; 2+ messages in thread
From: coelho @ 2011-01-11 18:07 UTC (permalink / raw)
To: linux-wireless; +Cc: jonathanc
From: Luciano Coelho <coelho@ti.com>
We were calling ieee80211_find_sta() and the sta returned by it
without locking the RCU, which is required by mac80211.
Fix this and reorganize slightly the area of the code where the sta is
used.
Reported-by: Jonathan DE CESCO <jonathanc@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/main.c | 60 +++++++++++++++++++----------------
1 files changed, 33 insertions(+), 27 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 862ec9c..67732ea 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2219,7 +2219,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
bool do_join = false, set_assoc = false;
bool is_ibss = (wl->bss_type == BSS_TYPE_IBSS);
int ret;
- struct ieee80211_sta *sta = ieee80211_find_sta(vif, bss_conf->bssid);
+ struct ieee80211_sta *sta;
if (is_ibss) {
ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf,
@@ -2376,36 +2376,42 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
if (ret < 0)
goto out;
- /*
- * Takes care of: New association with HT enable,
- * HT information change in beacon.
- */
- if (sta &&
- (changed & BSS_CHANGED_HT) &&
- (bss_conf->channel_type != NL80211_CHAN_NO_HT)) {
- ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, true);
- if (ret < 0) {
- wl1271_warning("Set ht cap true failed %d", ret);
- goto out;
- }
+ rcu_read_lock();
+ sta = ieee80211_find_sta(vif, bss_conf->bssid);
+ if (sta) {
+ /* handle new association with HT and HT information change */
+ if ((changed & BSS_CHANGED_HT) &&
+ (bss_conf->channel_type != NL80211_CHAN_NO_HT)) {
+ ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap,
+ true);
+ if (ret < 0) {
+ wl1271_warning("Set ht cap true failed %d",
+ ret);
+ rcu_read_unlock();
+ goto out;
+ }
ret = wl1271_acx_set_ht_information(wl,
- bss_conf->ht_operation_mode);
- if (ret < 0) {
- wl1271_warning("Set ht information failed %d", ret);
- goto out;
+ bss_conf->ht_operation_mode);
+ if (ret < 0) {
+ wl1271_warning("Set ht information failed %d",
+ ret);
+ rcu_read_unlock();
+ goto out;
+ }
}
- }
- /*
- * Takes care of: New association without HT,
- * Disassociation.
- */
- else if (sta && (changed & BSS_CHANGED_ASSOC)) {
- ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap, false);
- if (ret < 0) {
- wl1271_warning("Set ht cap false failed %d", ret);
- goto out;
+ /* handle new association without HT and disassociation */
+ else if (changed & BSS_CHANGED_ASSOC) {
+ ret = wl1271_acx_set_ht_capabilities(wl, &sta->ht_cap,
+ false);
+ if (ret < 0) {
+ wl1271_warning("Set ht cap false failed %d",
+ ret);
+ rcu_read_unlock();
+ goto out;
+ }
}
}
+ rcu_read_unlock();
if (changed & BSS_CHANGED_ARP_FILTER) {
__be32 addr = bss_conf->arp_addr_list[0];
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] wl12xx: lock the RCU when accessing sta via ieee80211_find_sta()
2011-01-11 18:07 [PATCH] wl12xx: lock the RCU when accessing sta via ieee80211_find_sta() coelho
@ 2011-01-13 11:33 ` Luciano Coelho
0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2011-01-13 11:33 UTC (permalink / raw)
To: linux-wireless@vger.kernel.org; +Cc: DE CESCO, Jonathan
On Tue, 2011-01-11 at 19:07 +0100, coelho@ti.com wrote:
> From: Luciano Coelho <coelho@ti.com>
>
> We were calling ieee80211_find_sta() and the sta returned by it
> without locking the RCU, which is required by mac80211.
>
> Fix this and reorganize slightly the area of the code where the sta is
> used.
>
> Reported-by: Jonathan DE CESCO <jonathanc@ti.com>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---
Applied and pushed to wl12xx.
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-01-13 11:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-11 18:07 [PATCH] wl12xx: lock the RCU when accessing sta via ieee80211_find_sta() coelho
2011-01-13 11:33 ` Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).