]> git.karo-electronics.de Git - linux-beck.git/commitdiff
wl12xx: Make sure HW is available in sched scan ops
authorPontus Fuchs <pontus.fuchs@gmail.com>
Wed, 11 Jan 2012 13:22:42 +0000 (14:22 +0100)
committerLuciano Coelho <coelho@ti.com>
Wed, 15 Feb 2012 06:38:28 +0000 (08:38 +0200)
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.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/main.c

index f8748cedbae19bfb4753ec579cec9c9040030fdf..f2a958c9537a347483a11a81c936f0f776508b80 100644 (file)
@@ -3108,6 +3108,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;
@@ -3139,6 +3144,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;