From: Luciano Coelho Date: Thu, 12 May 2011 14:07:55 +0000 (+0300) Subject: wl12xx: prevent sched_scan when not idle or not in station mode X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=683c002447c12742f5151691083f68524f33b13a;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git wl12xx: prevent sched_scan when not idle or not in station mode 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 --- diff --git a/drivers/net/wireless/wl12xx/scan.c b/drivers/net/wireless/wl12xx/scan.c index 668ff46a6824..f37e5a391976 100644 --- a/drivers/net/wireless/wl12xx/scan.c +++ b/drivers/net/wireless/wl12xx/scan.c @@ -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;