72a3510aacfff1df36aebe1d377e6514048d13a2
[openwrt/openwrt.git] /
1 From: Issam Hamdi <ih@simonwunderlich.de>
2 Date: Fri, 16 Aug 2024 16:24:18 +0200
3 Subject: [PATCH] wifi: cfg80211: Set correct chandef when starting CAC
4
5 When starting CAC in a mode other than AP mode, it return a
6 "WARNING: CPU: 0 PID: 63 at cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]"
7 caused by the chandef.chan being null at the end of CAC.
8
9 Solution: Ensure the channel definition is set for the different modes
10 when starting CAC to avoid getting a NULL 'chan' at the end of CAC.
11
12 Call Trace:
13 ? show_regs.part.0+0x14/0x16
14 ? __warn+0x67/0xc0
15 ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]
16 ? report_bug+0xa7/0x130
17 ? exc_overflow+0x30/0x30
18 ? handle_bug+0x27/0x50
19 ? exc_invalid_op+0x18/0x60
20 ? handle_exception+0xf6/0xf6
21 ? exc_overflow+0x30/0x30
22 ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]
23 ? exc_overflow+0x30/0x30
24 ? cfg80211_chandef_dfs_usable+0x20/0xaf [cfg80211]
25 ? regulatory_propagate_dfs_state.cold+0x1b/0x4c [cfg80211]
26 ? cfg80211_propagate_cac_done_wk+0x1a/0x30 [cfg80211]
27 ? process_one_work+0x165/0x280
28 ? worker_thread+0x120/0x3f0
29 ? kthread+0xc2/0xf0
30 ? process_one_work+0x280/0x280
31 ? kthread_complete_and_exit+0x20/0x20
32 ? ret_from_fork+0x19/0x24
33
34 Reported-by: Kretschmer Mathias <mathias.kretschmer@fit.fraunhofer.de>
35 Signed-off-by: Issam Hamdi <ih@simonwunderlich.de>
36 Link: https://patch.msgid.link/20240816142418.3381951-1-ih@simonwunderlich.de
37 [shorten subject, remove OCB, reorder cases to match previous list]
38 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
39 ---
40
41 --- a/net/wireless/nl80211.c
42 +++ b/net/wireless/nl80211.c
43 @@ -10144,7 +10144,20 @@ static int nl80211_start_radar_detection
44
45 err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms);
46 if (!err) {
47 - wdev->links[0].ap.chandef = chandef;
48 + switch (wdev->iftype) {
49 + case NL80211_IFTYPE_AP:
50 + case NL80211_IFTYPE_P2P_GO:
51 + wdev->links[0].ap.chandef = chandef;
52 + break;
53 + case NL80211_IFTYPE_ADHOC:
54 + wdev->u.ibss.chandef = chandef;
55 + break;
56 + case NL80211_IFTYPE_MESH_POINT:
57 + wdev->u.mesh.chandef = chandef;
58 + break;
59 + default:
60 + break;
61 + }
62 wdev->cac_started = true;
63 wdev->cac_start_time = jiffies;
64 wdev->cac_time_ms = cac_time_ms;