wl12xx: set the AP-started flag only after setting keys
authorArik Nemtsov <arik@wizery.com>
Sun, 14 Aug 2011 10:17:37 +0000 (13:17 +0300)
committerLuciano Coelho <coelho@ti.com>
Mon, 22 Aug 2011 09:35:31 +0000 (12:35 +0300)
This fix eliminates a potential race between starting the AP role
and setting encryption keys.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
drivers/net/wireless/wl12xx/main.c

index ad0b5a1..a23b394 100644 (file)
@@ -3140,12 +3140,12 @@ static void wl1271_bss_info_changed_ap(struct wl1271 *wl,
                                if (ret < 0)
                                        goto out;
 
-                               set_bit(WL1271_FLAG_AP_STARTED, &wl->flags);
-                               wl1271_debug(DEBUG_AP, "started AP");
-
                                ret = wl1271_ap_init_hwenc(wl);
                                if (ret < 0)
                                        goto out;
+
+                               set_bit(WL1271_FLAG_AP_STARTED, &wl->flags);
+                               wl1271_debug(DEBUG_AP, "started AP");
                        }
                } else {
                        if (test_bit(WL1271_FLAG_AP_STARTED, &wl->flags)) {