diff options
author | Stanislaw Gruszka <sgruszka@redhat.com> | 2012-03-28 10:01:19 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-04-13 14:31:49 -0400 |
commit | 133d40f9a22bdfd2617a446f1e3209537c5415ec (patch) | |
tree | f1a1cf510935348bede001983773a879df94fce5 /net/mac80211/mlme.c | |
parent | f277683477c7bdff8236e731cf882b3ef89dde0d (diff) |
mac80211: do not scan and monitor connection in parallel
Before we send probes in connection monitoring we check if scan is not
pending. But we do that check without locking. Fix that and also do not
start scan if connection monitoring is in progress.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r-- | net/mac80211/mlme.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index bbf1100d90d6..c8836fa7d627 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -1447,19 +1447,24 @@ void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata, | |||
1447 | static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) | 1447 | static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) |
1448 | { | 1448 | { |
1449 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | 1449 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; |
1450 | struct ieee80211_local *local = sdata->local; | ||
1450 | 1451 | ||
1452 | mutex_lock(&local->mtx); | ||
1451 | if (!(ifmgd->flags & (IEEE80211_STA_BEACON_POLL | | 1453 | if (!(ifmgd->flags & (IEEE80211_STA_BEACON_POLL | |
1452 | IEEE80211_STA_CONNECTION_POLL))) | 1454 | IEEE80211_STA_CONNECTION_POLL))) { |
1453 | return; | 1455 | mutex_unlock(&local->mtx); |
1456 | return; | ||
1457 | } | ||
1454 | 1458 | ||
1455 | ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | | 1459 | ifmgd->flags &= ~(IEEE80211_STA_CONNECTION_POLL | |
1456 | IEEE80211_STA_BEACON_POLL); | 1460 | IEEE80211_STA_BEACON_POLL); |
1457 | mutex_lock(&sdata->local->iflist_mtx); | 1461 | |
1458 | ieee80211_recalc_ps(sdata->local, -1); | 1462 | mutex_lock(&local->iflist_mtx); |
1459 | mutex_unlock(&sdata->local->iflist_mtx); | 1463 | ieee80211_recalc_ps(local, -1); |
1464 | mutex_unlock(&local->iflist_mtx); | ||
1460 | 1465 | ||
1461 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) | 1466 | if (sdata->local->hw.flags & IEEE80211_HW_CONNECTION_MONITOR) |
1462 | return; | 1467 | goto out; |
1463 | 1468 | ||
1464 | /* | 1469 | /* |
1465 | * We've received a probe response, but are not sure whether | 1470 | * We've received a probe response, but are not sure whether |
@@ -1471,6 +1476,9 @@ static void ieee80211_reset_ap_probe(struct ieee80211_sub_if_data *sdata) | |||
1471 | mod_timer(&ifmgd->conn_mon_timer, | 1476 | mod_timer(&ifmgd->conn_mon_timer, |
1472 | round_jiffies_up(jiffies + | 1477 | round_jiffies_up(jiffies + |
1473 | IEEE80211_CONNECTION_IDLE_TIME)); | 1478 | IEEE80211_CONNECTION_IDLE_TIME)); |
1479 | out: | ||
1480 | ieee80211_run_deferred_scan(local); | ||
1481 | mutex_unlock(&local->mtx); | ||
1474 | } | 1482 | } |
1475 | 1483 | ||
1476 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, | 1484 | void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata, |
@@ -1546,17 +1554,18 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
1546 | if (!ieee80211_sdata_running(sdata)) | 1554 | if (!ieee80211_sdata_running(sdata)) |
1547 | return; | 1555 | return; |
1548 | 1556 | ||
1549 | if (sdata->local->scanning) | ||
1550 | return; | ||
1551 | |||
1552 | if (sdata->local->tmp_channel) | ||
1553 | return; | ||
1554 | |||
1555 | mutex_lock(&ifmgd->mtx); | 1557 | mutex_lock(&ifmgd->mtx); |
1556 | 1558 | ||
1557 | if (!ifmgd->associated) | 1559 | if (!ifmgd->associated) |
1558 | goto out; | 1560 | goto out; |
1559 | 1561 | ||
1562 | mutex_lock(&sdata->local->mtx); | ||
1563 | |||
1564 | if (sdata->local->tmp_channel || sdata->local->scanning) { | ||
1565 | mutex_unlock(&sdata->local->mtx); | ||
1566 | goto out; | ||
1567 | } | ||
1568 | |||
1560 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1569 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1561 | if (beacon && net_ratelimit()) | 1570 | if (beacon && net_ratelimit()) |
1562 | printk(KERN_DEBUG "%s: detected beacon loss from AP " | 1571 | printk(KERN_DEBUG "%s: detected beacon loss from AP " |
@@ -1583,6 +1592,8 @@ static void ieee80211_mgd_probe_ap(struct ieee80211_sub_if_data *sdata, | |||
1583 | else | 1592 | else |
1584 | ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; | 1593 | ifmgd->flags |= IEEE80211_STA_CONNECTION_POLL; |
1585 | 1594 | ||
1595 | mutex_unlock(&sdata->local->mtx); | ||
1596 | |||
1586 | if (already) | 1597 | if (already) |
1587 | goto out; | 1598 | goto out; |
1588 | 1599 | ||