]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: cfg80211: stop radar detection in cfg80211_leave()
authorJohannes Berg <johannes.berg@intel.com>
Fri, 21 Nov 2025 16:40:21 +0000 (17:40 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Mon, 24 Nov 2025 12:05:23 +0000 (13:05 +0100)
If an interface is set down or, per the previous patch, changes
type, radar detection for it should be cancelled. This is done
for AP mode in mac80211 (somewhat needlessly, since cfg80211 can
do it, but didn't until now), but wasn't handled for mesh, so if
radar detection was started and then the interface set down or
its type switched (the latter sometimes happning in the hwsim
test 'mesh_peer_connected_dfs'), radar detection would be around
with the interface unknown to the driver, later leading to some
warnings around chanctx usage.

Link: https://patch.msgid.link/20251121174021.290120e419e3.I2a5650c9062e29c988992dd8ce0d8eb570d23267@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/wireless/core.c
net/wireless/core.h
net/wireless/mlme.c

index 7be25b9ae36ed452c2f5a9295e496af511f754a5..9a420d627d3ce095b70492336be131f64c61e5a1 100644 (file)
@@ -1380,6 +1380,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
 
        cfg80211_pmsr_wdev_down(wdev);
 
+       cfg80211_stop_radar_detection(wdev);
        cfg80211_stop_background_radar_detection(wdev);
 
        switch (wdev->iftype) {
index 82f343663e8fadaefbb45bb11dc03695a825925d..63dcf315dba7cfcc0c17b8c287a5b5eaceab532f 100644 (file)
@@ -489,6 +489,7 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde
                                          struct wireless_dev *wdev,
                                          struct cfg80211_chan_def *chandef);
 
+void cfg80211_stop_radar_detection(struct wireless_dev *wdev);
 void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev);
 
 void cfg80211_background_cac_done_wk(struct work_struct *work);
index 46394eb2086f6e8f1c38da4a743ef4e6f5f80413..3fc175f9f868614c2f7eda5dc47b3b40726e41a2 100644 (file)
@@ -1295,6 +1295,25 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde
        return 0;
 }
 
+void cfg80211_stop_radar_detection(struct wireless_dev *wdev)
+{
+       struct wiphy *wiphy = wdev->wiphy;
+       struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
+       int link_id;
+
+       for_each_valid_link(wdev, link_id) {
+               struct cfg80211_chan_def chandef;
+
+               if (!wdev->links[link_id].cac_started)
+                       continue;
+
+               chandef = *wdev_chandef(wdev, link_id);
+               rdev_end_cac(rdev, wdev->netdev, link_id);
+               nl80211_radar_notify(rdev, &chandef, NL80211_RADAR_CAC_ABORTED,
+                                    wdev->netdev, GFP_KERNEL);
+       }
+}
+
 void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev)
 {
        struct wiphy *wiphy = wdev->wiphy;