aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r--net/mac80211/scan.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index adf94ba1ed77..4d31d9688dc2 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -520,10 +520,33 @@ static int ieee80211_start_sw_scan(struct ieee80211_local *local,
520 return 0; 520 return 0;
521} 521}
522 522
523static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata)
524{
525 struct ieee80211_local *local = sdata->local;
526 struct ieee80211_sub_if_data *sdata_iter;
527
528 if (!ieee80211_is_radar_required(local))
529 return true;
530
531 if (!regulatory_pre_cac_allowed(local->hw.wiphy))
532 return false;
533
534 mutex_lock(&local->iflist_mtx);
535 list_for_each_entry(sdata_iter, &local->interfaces, list) {
536 if (sdata_iter->wdev.cac_started) {
537 mutex_unlock(&local->iflist_mtx);
538 return false;
539 }
540 }
541 mutex_unlock(&local->iflist_mtx);
542
543 return true;
544}
545
523static bool ieee80211_can_scan(struct ieee80211_local *local, 546static bool ieee80211_can_scan(struct ieee80211_local *local,
524 struct ieee80211_sub_if_data *sdata) 547 struct ieee80211_sub_if_data *sdata)
525{ 548{
526 if (ieee80211_is_radar_required(local)) 549 if (!__ieee80211_can_leave_ch(sdata))
527 return false; 550 return false;
528 551
529 if (!list_empty(&local->roc_list)) 552 if (!list_empty(&local->roc_list))
@@ -630,7 +653,10 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
630 653
631 lockdep_assert_held(&local->mtx); 654 lockdep_assert_held(&local->mtx);
632 655
633 if (local->scan_req || ieee80211_is_radar_required(local)) 656 if (local->scan_req)
657 return -EBUSY;
658
659 if (!__ieee80211_can_leave_ch(sdata))
634 return -EBUSY; 660 return -EBUSY;
635 661
636 if (!ieee80211_can_scan(local, sdata)) { 662 if (!ieee80211_can_scan(local, sdata)) {