Skip to content

Commit 9f33477

Browse files
committed
wifi: cfg80211: stop radar detection in cfg80211_leave()
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>
1 parent 7a27b73 commit 9f33477

3 files changed

Lines changed: 21 additions & 0 deletions

File tree

net/wireless/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,6 +1380,7 @@ void cfg80211_leave(struct cfg80211_registered_device *rdev,
13801380

13811381
cfg80211_pmsr_wdev_down(wdev);
13821382

1383+
cfg80211_stop_radar_detection(wdev);
13831384
cfg80211_stop_background_radar_detection(wdev);
13841385

13851386
switch (wdev->iftype) {

net/wireless/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,7 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde
489489
struct wireless_dev *wdev,
490490
struct cfg80211_chan_def *chandef);
491491

492+
void cfg80211_stop_radar_detection(struct wireless_dev *wdev);
492493
void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev);
493494

494495
void cfg80211_background_cac_done_wk(struct work_struct *work);

net/wireless/mlme.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1295,6 +1295,25 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde
12951295
return 0;
12961296
}
12971297

1298+
void cfg80211_stop_radar_detection(struct wireless_dev *wdev)
1299+
{
1300+
struct wiphy *wiphy = wdev->wiphy;
1301+
struct cfg80211_registered_device *rdev = wiphy_to_rdev(wiphy);
1302+
int link_id;
1303+
1304+
for_each_valid_link(wdev, link_id) {
1305+
struct cfg80211_chan_def chandef;
1306+
1307+
if (!wdev->links[link_id].cac_started)
1308+
continue;
1309+
1310+
chandef = *wdev_chandef(wdev, link_id);
1311+
rdev_end_cac(rdev, wdev->netdev, link_id);
1312+
nl80211_radar_notify(rdev, &chandef, NL80211_RADAR_CAC_ABORTED,
1313+
wdev->netdev, GFP_KERNEL);
1314+
}
1315+
}
1316+
12981317
void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev)
12991318
{
13001319
struct wiphy *wiphy = wdev->wiphy;

0 commit comments

Comments
 (0)