Skip to contentSkip to conversation

wl12xx: Make sure HW is available in sched scan ops

PATCH Applied Pontus Fuchs 2 participants 2 messages Jan 11, 2012 – Jan 12, 2012 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wl12xx: Make sure HW is available in sched scan ops

The sched_scan_(stop|start) ops fails to check for WL1271_STATE_OFF. This can lead to a race where the driver tries to access the HW while it's off.

Fix this by checking for WL1271_STATE_OFF before accessing the HW.

---
 drivers/net/wireless/wl12xx/main.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/net/wireless/wl12xx/main.c +8 -0
index d5f55a1..915d56c 100644
@@ -3105,6 +3105,11 @@ static int wl1271_op_sched_scan_start(struct ieee80211_hw *hw,
 
 	mutex_lock(&wl->mutex);
 
+	if (wl->state == WL1271_STATE_OFF) {
+		ret = -EAGAIN;
+		goto out;
+	}
+
 	ret = wl1271_ps_elp_wakeup(wl);
 	if (ret < 0)
 		goto out;
@@ -3136,6 +3141,9 @@ static void wl1271_op_sched_scan_stop(struct ieee80211_hw *hw,
 
 	mutex_lock(&wl->mutex);
 
+	if (wl->state == WL1271_STATE_OFF)
+		goto out;
+
 	ret = wl1271_ps_elp_wakeup(wl);
 	if (ret < 0)
 		goto out;
Signature · 1 line
1.7.5.4
#1 lore raw
Quoted 8 lines · Pontus Fuchs

The sched_scan_(stop|start) ops fails to check for WL1271_STATE_OFF. This can lead to a race where the driver tries to access the HW while it's off.

Fix this by checking for WL1271_STATE_OFF before accessing the HW.

---

Applied, thanks!

Signature · 2 lines
Cheers,
Luca.