wlcore: don't switch channels on disconnected STA vifs
authorArik Nemtsov <arik@wizery.com>
Fri, 11 Jul 2014 00:01:36 +0000 (03:01 +0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 15 Jul 2014 20:00:00 +0000 (16:00 -0400)
Sending the FW a channel switch command on a disconnected
vif may result in a beacon loss event. Avoid this corner case.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ti/wlcore/main.c

index d92f578dd95ccbfbe9336d1b604d447cd0b55b24..ec211413ffe6b3ff4e34bbd6d572cd622f5a735d 100644 (file)
@@ -5192,6 +5192,10 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw,
        if (unlikely(wl->state == WLCORE_STATE_OFF)) {
                wl12xx_for_each_wlvif_sta(wl, wlvif) {
                        struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
+
+                       if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
+                               continue;
+
                        ieee80211_chswitch_done(vif, false);
                }
                goto out;
@@ -5207,6 +5211,9 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw,
        wl12xx_for_each_wlvif_sta(wl, wlvif) {
                unsigned long delay_usec;
 
+               if (!test_bit(WLVIF_FLAG_STA_ASSOCIATED, &wlvif->flags))
+                       continue;
+
                ret = wl->ops->channel_switch(wl, wlvif, ch_switch);
                if (ret)
                        goto out_sleep;