linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] wl12xx: avoid blocking while holding rcu lock on bss info change
@ 2011-02-12 21:24 Arik Nemtsov
  2011-02-23 13:53 ` Luciano Coelho
  0 siblings, 1 reply; 2+ messages in thread
From: Arik Nemtsov @ 2011-02-12 21:24 UTC (permalink / raw)
  To: linux-wireless; +Cc: Luciano Coelho, Arik Nemtsov

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: Arik Nemtsov <arik@wizery.com>
---
 drivers/net/wireless/wl12xx/main.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/wl12xx/main.c b/drivers/net/wireless/wl12xx/main.c
index 61dea73..40b1bf1 100644
--- a/drivers/net/wireless/wl12xx/main.c
+++ b/drivers/net/wireless/wl12xx/main.c
@@ -2218,6 +2218,8 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 	u32 sta_rate_set = 0;
 	int ret;
 	struct ieee80211_sta *sta;
+	bool sta_exists = false;
+	struct ieee80211_sta_ht_cap sta_ht_cap;
 
 	if (is_ibss) {
 		ret = wl1271_bss_beacon_info_changed(wl, vif, bss_conf,
@@ -2289,16 +2291,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 		if (sta->ht_cap.ht_supported)
 			sta_rate_set |=
 			    (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 */
 		if ((changed & BSS_CHANGED_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);
 			if (ret < 0) {
 				wl1271_warning("Set ht cap true failed %d",
 					       ret);
-				rcu_read_unlock();
 				goto out;
 			}
 			ret = wl1271_acx_set_ht_information(wl,
@@ -2306,23 +2312,20 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
 			if (ret < 0) {
 				wl1271_warning("Set ht information failed %d",
 					       ret);
-				rcu_read_unlock();
 				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,
+			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_ASSOC)) {
 		if (bss_conf->assoc) {
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] wl12xx: avoid blocking while holding rcu lock on bss info change
  2011-02-12 21:24 [PATCH] wl12xx: avoid blocking while holding rcu lock on bss info change Arik Nemtsov
@ 2011-02-23 13:53 ` Luciano Coelho
  0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2011-02-23 13:53 UTC (permalink / raw)
  To: Arik Nemtsov; +Cc: linux-wireless

On Sat, 2011-02-12 at 23:24 +0200, Arik Nemtsov wrote:
> 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: Arik Nemtsov <arik@wizery.com>
> --- 

Applied, thank you!

-- 
Cheers,
Luca.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-23 13:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-02-12 21:24 [PATCH] wl12xx: avoid blocking while holding rcu lock on bss info change Arik Nemtsov
2011-02-23 13:53 ` 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).