wl12xx: prevent sched_scan when not idle or not in station mode
authorLuciano Coelho <coelho@ti.com>
Thu, 12 May 2011 14:07:55 +0000 (17:07 +0300)
committerLuciano Coelho <coelho@ti.com>
Thu, 12 May 2011 21:06:33 +0000 (00:06 +0300)
The current firmware only supports scheduled scan in station mode and
when idle.  To prevent the firmware from crashing, return -EOPNOTSUPP
when sched_scan start is called in an invalid state.

Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/scan.c

index 668ff46a682462edea5ac471d41a0964ec0fce53..f37e5a3919763b45f5b2f96f4f9b9d6d54e3f9ad 100644 (file)
@@ -505,6 +505,12 @@ int wl1271_scan_sched_scan_start(struct wl1271 *wl)
 
        wl1271_debug(DEBUG_CMD, "cmd periodic scan start");
 
+       if (wl->bss_type != BSS_TYPE_STA_BSS)
+               return -EOPNOTSUPP;
+
+       if (!test_bit(WL1271_FLAG_IDLE, &wl->flags))
+               return -EBUSY;
+
        start = kzalloc(sizeof(*start), GFP_KERNEL);
        if (!start)
                return -ENOMEM;