aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2012-05-16 09:27:20 -0400
committerJohn W. Linville <linville@tuxdriver.com>2012-06-04 15:21:18 -0400
commit925e64c3c512e9f4452eaa7d52fd4c1518b8fb11 (patch)
treeac410037bd1fe1377b2b32688a0c5e40e5f2f149 /net
parentf8f5701bdaf9134b1f90e5044a82c66324d2073f (diff)
mac80211: run scan after finish connection monitoring
commit 133d40f9a22bdfd2617a446f1e3209537c5415ec Author: Stanislaw Gruszka <sgruszka@redhat.com> Date: Wed Mar 28 16:01:19 2012 +0200 mac80211: do not scan and monitor connection in parallel add bug, which make possible to start a scan and never finish it, so make every new scanning request finish with -EBUSY error. This can happen on code paths where we finish connection monitoring and clear IEEE80211_STA_*_POLL flags, but do not check if scan was deferred. This patch fixes those code paths. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/mlme.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 04c306308987..d94627c2929c 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1220,6 +1220,22 @@ static void ieee80211_sta_wmm_params(struct ieee80211_local *local,
1220 sdata->vif.bss_conf.qos = true; 1220 sdata->vif.bss_conf.qos = true;
1221} 1221}
1222 1222
1223static void __ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
1224{
1225 lockdep_assert_held(&sdata->local->mtx);
1226
1227 sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL |
1228 IEEE80211_STA_BEACON_POLL);
1229 ieee80211_run_deferred_scan(sdata->local);
1230}
1231
1232static void ieee80211_stop_poll(struct ieee80211_sub_if_data *sdata)
1233{
1234 mutex_lock(&sdata->local->mtx);
1235 __ieee80211_stop_poll(sdata);
1236 mutex_unlock(&sdata->local->mtx);
1237}
1238
1223static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata, 1239static u32 ieee80211_handle_bss_capability(struct ieee80211_sub_if_data *sdata,
1224 u16 capab, bool erp_valid, u8 erp) 1240 u16 capab, bool erp_valid, u8 erp)
1225{ 1241{
@@ -1285,8 +1301,7 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata,
1285 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE; 1301 sdata->u.mgd.flags |= IEEE80211_STA_RESET_SIGNAL_AVE;
1286 1302
1287 /* just to be sure */ 1303 /* just to be sure */
1288 sdata->u.mgd.flags &= ~(IEEE80211_STA_CONNECTION_POLL | 1304 ieee80211_stop_poll(sdata);
1289 IEEE80211_STA_BEACON_POLL);
1290 1305
1291 ieee80211_led_assoc(local, 1); 1306 ieee80211_led_assoc(local, 1);
1292 1307
@@ -1456,8 +1471,7 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
1456 return; 1471 return;
1457 } 1472 }
1458 1473
1459 ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | 1474 __ieee80211_stop_poll(sdata);
1460 IEEE80211_STA_BEACON_POLL);
1461 1475
1462 mutex_lock(&local->iflist_mtx); 1476 mutex_lock(&local->iflist_mtx);
1463 ieee80211_recalc_ps(local, -1); 1477 ieee80211_recalc_ps(local, -1);
@@ -1477,7 +1491,6 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata)
1477 round_jiffies_up(jiffies + 1491 round_jiffies_up(jiffies +
1478 IEEE80211_CONNECTION_IDLE_TIME)); 1492 IEEE80211_CONNECTION_IDLE_TIME));
1479out: 1493out:
1480 ieee80211_run_deferred_scan(local);
1481 mutex_unlock(&local->mtx); 1494 mutex_unlock(&local->mtx);
1482} 1495}
1483 1496
@@ -2408,7 +2421,11 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2408 net_dbg_ratelimited("%s: cancelling probereq poll due to a received beacon\n", 2421 net_dbg_ratelimited("%s: cancelling probereq poll due to a received beacon\n",
2409 sdata->name); 2422 sdata->name);
2410#endif 2423#endif
2424 mutex_lock(&local->mtx);
2411 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL; 2425 ifmgd->flags &= ~IEEE80211_STA_BEACON_POLL;
2426 ieee80211_run_deferred_scan(local);
2427 mutex_unlock(&local->mtx);
2428
2412 mutex_lock(&local->iflist_mtx); 2429 mutex_lock(&local->iflist_mtx);
2413 ieee80211_recalc_ps(local, -1); 2430 ieee80211_recalc_ps(local, -1);
2414 mutex_unlock(&local->iflist_mtx); 2431 mutex_unlock(&local->iflist_mtx);
@@ -2595,8 +2612,7 @@ static void ieee80211_sta_connection_lost(struct ieee80211_sub_if_data *sdata,
2595 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 2612 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
2596 u8 frame_buf[DEAUTH_DISASSOC_LEN]; 2613 u8 frame_buf[DEAUTH_DISASSOC_LEN];
2597 2614
2598 ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | 2615 ieee80211_stop_poll(sdata);
2599 IEEE80211_STA_BEACON_POLL);
2600 2616
2601 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason, 2617 ieee80211_set_disassoc(sdata, IEEE80211_STYPE_DEAUTH, reason,
2602 false, frame_buf); 2618 false, frame_buf);
@@ -2874,8 +2890,7 @@ static void ieee80211_restart_sta_timer(struct ieee80211_sub_if_data *sdata)
2874 u32 flags; 2890 u32 flags;
2875 2891
2876 if (sdata->vif.type == NL80211_IFTYPE_STATION) { 2892 if (sdata->vif.type == NL80211_IFTYPE_STATION) {
2877 sdata->u.mgd.flags &= ~(IEEE80211_STA_BEACON_POLL | 2893 __ieee80211_stop_poll(sdata);
2878 IEEE80211_STA_CONNECTION_POLL);
2879 2894
2880 /* let's probe the connection once */ 2895 /* let's probe the connection once */
2881 flags = sdata->local->hw.flags; 2896 flags = sdata->local->hw.flags;
@@ -2944,7 +2959,10 @@ void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata)
2944 if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running)) 2959 if (test_and_clear_bit(TMR_RUNNING_CHANSW, &ifmgd->timers_running))
2945 add_timer(&ifmgd->chswitch_timer); 2960 add_timer(&ifmgd->chswitch_timer);
2946 ieee80211_sta_reset_beacon_monitor(sdata); 2961 ieee80211_sta_reset_beacon_monitor(sdata);
2962
2963 mutex_lock(&sdata->local->mtx);
2947 ieee80211_restart_sta_timer(sdata); 2964 ieee80211_restart_sta_timer(sdata);
2965 mutex_unlock(&sdata->local->mtx);
2948} 2966}
2949#endif 2967#endif
2950 2968