]> www.infradead.org Git - users/hch/misc.git/commitdiff
wifi: mac80211: consider links for validating SCAN_FLAG_AP in scan request during MLO
authorAditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Tue, 12 Aug 2025 07:23:30 +0000 (12:53 +0530)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 4 Sep 2025 09:19:02 +0000 (11:19 +0200)
Commit 78a7a126dc5b ("wifi: mac80211: validate SCAN_FLAG_AP in scan request
during MLO") introduced a check that rejects scan requests if any link is
already beaconing. This works fine when all links share the same radio, but
breaks down in multi-radio setups.

Consider a scenario where a 2.4 GHz link is beaconing and a scan is
requested on a 5 GHz link, each backed by a different physical radio. The
current logic still blocks the scan, even though it should be allowed. As a
result, interface bring-up fails unnecessarily in valid configurations.

Fix this by checking whether the scan is being requested on the same
underlying radio as the beaconing link. Only reject the scan if it targets
a link that is already beaconing and the NL80211_FEATURE_AP_SCAN is not
set. This ensures correct behavior in multi-radio environments and avoids
false rejections.

Fixes: 78a7a126dc5b ("wifi: mac80211: validate SCAN_FLAG_AP in scan request during MLO")
Signed-off-by: Aditya Kumar Singh <aditya.kumar.singh@oss.qualcomm.com>
Link: https://patch.msgid.link/20250812-fix_scan_ap_flag_requirement_during_mlo-v4-3-383ffb6da213@oss.qualcomm.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/cfg.c

index fca93cd36bd3919f9add1413aacef2a100bc7994..b26f61f13605a811e1a18a319730a12668aade8d 100644 (file)
@@ -3007,6 +3007,9 @@ static int ieee80211_scan(struct wiphy *wiphy,
                          struct cfg80211_scan_request *req)
 {
        struct ieee80211_sub_if_data *sdata;
+       struct ieee80211_link_data *link;
+       struct ieee80211_channel *chan;
+       int radio_idx;
 
        sdata = IEEE80211_WDEV_TO_SUB_IF(req->wdev);
 
@@ -3034,10 +3037,20 @@ static int ieee80211_scan(struct wiphy *wiphy,
                 * the frames sent while scanning on other channel will be
                 * lost)
                 */
-               if (ieee80211_num_beaconing_links(sdata) &&
-                   (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
-                    !(req->flags & NL80211_SCAN_FLAG_AP)))
-                       return -EOPNOTSUPP;
+               for_each_link_data(sdata, link) {
+                       /* if the link is not beaconing, ignore it */
+                       if (!sdata_dereference(link->u.ap.beacon, sdata))
+                               continue;
+
+                       chan = link->conf->chanreq.oper.chan;
+                       radio_idx = cfg80211_get_radio_idx_by_chan(wiphy, chan);
+
+                       if (ieee80211_is_radio_idx_in_scan_req(wiphy, req,
+                                                              radio_idx) &&
+                           (!(wiphy->features & NL80211_FEATURE_AP_SCAN) ||
+                            !(req->flags & NL80211_SCAN_FLAG_AP)))
+                               return -EOPNOTSUPP;
+               }
                break;
        case NL80211_IFTYPE_NAN:
        default: