* [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2
@ 2026-09-08 12:28 Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 01/10] wifi: mac80211: don't allow injecting frames wider than the chanctx Johannes Berg
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless
Since I split the series badly, this didn't apply, so here's a resend
for the bots.
johannes
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 01/10] wifi: mac80211: don't allow injecting frames wider than the chanctx
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 02/10] wifi: mac80211: reset the AP_VLAN tailroom counter on ifdown Johannes Berg
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+435fdb053cf98bfa5778
From: Johannes Berg <johannes.berg@intel.com>
Frames injected on a monitor interface can carry a radiotap
field requesting a bandwidth, which mac80211 passes down to
the driver regardless of the the actual operational bandwidth.
If the bandwidth requested is too wide, that triggers a warning
in hwsim:
WARN_ON(hwsim_get_chanwidth(bw) > hwsim_get_chanwidth(confbw))
Drop such frames entirely instead since they cannot be sent.
Assisted-by: LLM
Fixes: 646e76bb5daf ("mac80211: parse VHT info in injected frames")
Reported-by: syzbot+435fdb053cf98bfa5778@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=435fdb053cf98bfa5778
Link: https://patch.msgid.link/20260904170057.d9ece19b7307.I51d783668ff3b22f5bb0faaa93ed8f45b129f2b8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/net/mac80211.h | 5 ++++-
net/mac80211/iface.c | 2 +-
net/mac80211/tx.c | 28 ++++++++++++++++++++++++++--
3 files changed, 31 insertions(+), 4 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 9d1fac6e8082..ed6a5874ff96 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -7638,11 +7638,14 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw,
*
* @skb: packet injected by userspace
* @dev: the &struct device of this 802.11 device
+ * @chandef: the channel definition the frame will be transmitted on, or
+ * %NULL to skip the bandwidth checks
*
* Return: %true if the radiotap header was parsed, %false otherwise
*/
bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
- struct net_device *dev);
+ struct net_device *dev,
+ const struct cfg80211_chan_def *chandef);
/**
* struct ieee80211_noa_data - holds temporary data for tracking P2P NoA state
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 842bfb4a7cb6..ca66eb493ac7 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -991,7 +991,7 @@ static u16 ieee80211_monitor_select_queue(struct net_device *dev,
/* reset flags and info before parsing radiotap header */
memset(info, 0, sizeof(*info));
- if (!ieee80211_parse_tx_radiotap(skb, dev))
+ if (!ieee80211_parse_tx_radiotap(skb, dev, NULL))
return 0; /* doesn't matter, frame will be dropped */
len_rthdr = ieee80211_get_radiotap_len(skb->data);
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d155fb319a55..c343ed56506a 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2105,8 +2105,29 @@ static bool ieee80211_validate_radiotap_len(struct sk_buff *skb)
return true;
}
+static bool ieee80211_rate_bw_usable(u16 rate_flags,
+ const struct cfg80211_chan_def *chandef)
+{
+ int width;
+
+ if (!chandef)
+ return true;
+
+ if (rate_flags & IEEE80211_TX_RC_160_MHZ_WIDTH)
+ width = 160;
+ else if (rate_flags & IEEE80211_TX_RC_80_MHZ_WIDTH)
+ width = 80;
+ else if (rate_flags & IEEE80211_TX_RC_40_MHZ_WIDTH)
+ width = 40;
+ else
+ return true;
+
+ return width <= cfg80211_chandef_get_width(chandef);
+}
+
bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
- struct net_device *dev)
+ struct net_device *dev,
+ const struct cfg80211_chan_def *chandef)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct ieee80211_radiotap_iterator iterator;
@@ -2280,6 +2301,9 @@ bool ieee80211_parse_tx_radiotap(struct sk_buff *skb,
struct ieee80211_supported_band *sband =
local->hw.wiphy->bands[info->band];
+ if (!ieee80211_rate_bw_usable(rate_flags, chandef))
+ return false;
+
info->control.flags |= IEEE80211_TX_CTRL_RATE_INJECT;
for (i = 0; i < IEEE80211_TX_MAX_RATES; i++) {
@@ -2479,7 +2503,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
* selected chandef above to accurately set injection rates and
* retransmissions.
*/
- if (!ieee80211_parse_tx_radiotap(skb, dev))
+ if (!ieee80211_parse_tx_radiotap(skb, dev, chandef))
goto fail_rcu;
/* remove the injection radiotap header */
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 02/10] wifi: mac80211: reset the AP_VLAN tailroom counter on ifdown
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 01/10] wifi: mac80211: don't allow injecting frames wider than the chanctx Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 03/10] wifi: mac80211: require a peer station for TDLS setup confirm Johannes Berg
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+de3ee5362db09487ea37
From: Johannes Berg <johannes.berg@intel.com>
On ifup, AP_VLAN interfaces get crypto_tx_tailroom_needed_cnt from
the AP interface, but it's never decremented again unless the AP is
also brought down. Thus, bringing the same AP_VLAN up again will
increment the counter again and eventually hit the sanity check:
WARN_ON_ONCE(sdata->crypto_tx_tailroom_needed_cnt !=
master->crypto_tx_tailroom_needed_cnt);
Reset it on ifdown to avoid that.
Assisted-by: LLM
Fixes: f9dca80b98ca ("mac80211: fix AP_VLAN crypto tailroom calculation")
Reported-by: syzbot+de3ee5362db09487ea37@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=de3ee5362db09487ea37
Link: https://patch.msgid.link/20260904170057.1f4fc05e5663.Ic863c2fea0352a9282006378bc9c9dedbe27c037@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/iface.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index ca66eb493ac7..889c32fd8de1 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -616,6 +616,8 @@ static void ieee80211_do_stop(struct ieee80211_sub_if_data *sdata, bool going_do
RCU_INIT_POINTER(sdata->vif.bss_conf.chanctx_conf, NULL);
/* see comment in the default case below */
ieee80211_free_keys(sdata, true);
+ /* increased by AP value on ifup, so reset on ifdown */
+ sdata->crypto_tx_tailroom_needed_cnt = 0;
/* no need to tell driver */
break;
case NL80211_IFTYPE_MONITOR:
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 03/10] wifi: mac80211: require a peer station for TDLS setup confirm
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 01/10] wifi: mac80211: don't allow injecting frames wider than the chanctx Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 02/10] wifi: mac80211: reset the AP_VLAN tailroom counter on ifdown Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 04/10] wifi: mac80211: don't allow link changes when iface is down Johannes Berg
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+e55106f8389651870be0
From: Johannes Berg <johannes.berg@intel.com>
It's nonsense for the setup confirm to go to station that
doesn't even exist, and it hits a warning when building
the frame:
WARN_ON_ONCE(!sta || !ap_sta)
Only accept WLAN_TDLS_SETUP_CONFIRM when the station is
already there as a TDLS station. Need to copy the call
to ieee80211_tdls_prep_mgmt_packet() since the existing
WLAN_TDLS_DISCOVERY_REQUEST already falls through to it.
Assisted-by: LLM
Fixes: 6f7eaa47e1de ("mac80211: add TDLS QoS param IE on setup-confirm")
Reported-by: syzbot+e55106f8389651870be0@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=e55106f8389651870be0
Link: https://patch.msgid.link/20260904170057.2ff31ae3e799.Ie409325ed6f2e55d2ef3ff2439e0c054dc8233b8@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/tdls.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 7f40b1d62938..f663d28d9209 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -1281,6 +1281,24 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
peer_capability, initiator,
extra_ies, extra_ies_len);
break;
+ case WLAN_TDLS_SETUP_CONFIRM: {
+ struct sta_info *sta;
+
+ sta = sta_info_get(sdata, peer);
+ if (!sta || !sta->sta.tdls) {
+ ret = -ENOLINK;
+ break;
+ }
+
+ ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer,
+ link_id, action_code,
+ dialog_token,
+ status_code,
+ peer_capability,
+ initiator, extra_ies,
+ extra_ies_len, 0, NULL);
+ break;
+ }
case WLAN_TDLS_DISCOVERY_REQUEST:
/*
* Protect the discovery so we can hear the TDLS discovery
@@ -1289,7 +1307,6 @@ int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
*/
drv_mgd_protect_tdls_discover(sdata->local, sdata, link_id);
fallthrough;
- case WLAN_TDLS_SETUP_CONFIRM:
case WLAN_PUB_ACTION_TDLS_DISCOVER_RES:
/* no special handling */
ret = ieee80211_tdls_prep_mgmt_packet(wiphy, dev, peer,
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 04/10] wifi: mac80211: don't allow link changes when iface is down
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (2 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 03/10] wifi: mac80211: require a peer station for TDLS setup confirm Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 05/10] wifi: mac80211: don't RCU-dereference the mesh CSA settings we just set Johannes Berg
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+582469b3a9ef5f13606b
From: Johannes Berg <johannes.berg@intel.com>
ieee80211_set_active_links() only checks that the interface is running in
the inner __ieee80211_set_active_links(), after drv_can_activate_links()
was already called, so using active_links on an interface that's down
triggers the check-sdata-in-driver warning.
Add the missing check in the debugfs file.
Assisted-by: LLM
Fixes: 3d9011029227 ("wifi: mac80211: implement link switching")
Reported-by: syzbot+582469b3a9ef5f13606b@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=582469b3a9ef5f13606b
Link: https://patch.msgid.link/20260904170057.56ab694fe989.I6d85e530bc2db6e48bfd13ccee0b71155e32b85b@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/debugfs_netdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index f3c6a41e4911..8346d3eb1143 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -729,6 +729,9 @@ static ssize_t ieee80211_if_parse_active_links(struct ieee80211_sub_if_data *sda
if (kstrtou16(buf, 0, &active_links) || !active_links)
return -EINVAL;
+ if (!ieee80211_sdata_running(sdata))
+ return -ENETDOWN;
+
return ieee80211_set_active_links(&sdata->vif, active_links) ?: buflen;
}
IEEE80211_IF_FILE_RW(active_links);
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 05/10] wifi: mac80211: don't RCU-dereference the mesh CSA settings we just set
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (3 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 04/10] wifi: mac80211: don't allow link changes when iface is down Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 06/10] wifi: mac80211: don't access the TSF of a down interface Johannes Berg
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+b59873f5699e941717ca
From: Johannes Berg <johannes.berg@intel.com>
In the error path of ieee80211_mesh_csa_beacon() the settings that were
just assigned are read back with rcu_dereference(), which lockdep then
complains about.
There's no need to read the pointer at all, tmp_csa_settings still is
the right value anyway.
Assisted-by: LLM
Fixes: b8456a14e9d2 ("{nl,cfg,mac}80211: implement mesh channel switch userspace API")
Reported-by: syzbot+b59873f5699e941717ca@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b59873f5699e941717ca
Link: https://patch.msgid.link/20260904170057.30c3a1780224.Ia633160bc01e1ad1b30a9f44446728a747f2b16a@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/mesh.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index bed7ac838250..a35e2d5870b6 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -1559,7 +1559,6 @@ int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
ret = ieee80211_mesh_rebuild_beacon(sdata);
if (ret) {
- tmp_csa_settings = rcu_dereference(ifmsh->csa);
RCU_INIT_POINTER(ifmsh->csa, NULL);
kfree_rcu(tmp_csa_settings, rcu_head);
return ret;
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 06/10] wifi: mac80211: don't access the TSF of a down interface
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (4 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 05/10] wifi: mac80211: don't RCU-dereference the mesh CSA settings we just set Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 07/10] wifi: mac80211: add HE 6 GHz capability in the scan elems len Johannes Berg
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+1c8c45017f784e646b47
From: Johannes Berg <johannes.berg@intel.com>
The tsf debugfs files call the driver even if the interface
isn't up, tgriggering check-sdata-in-driver warnings.
Reject the access in that case.
Assisted-by: LLM
Fixes: 37a41b4affa3 ("mac80211: add ieee80211_vif param to tsf functions")
Reported-by: syzbot+1c8c45017f784e646b47@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=1c8c45017f784e646b47
Link: https://patch.msgid.link/20260904170057.6de1230f9a7b.I7115b209d73732ac2a9916fe19ffee6b1d9abc2f@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/debugfs_netdev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 8346d3eb1143..6aba22493670 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -657,6 +657,9 @@ static ssize_t ieee80211_if_fmt_tsf(
struct ieee80211_local *local = sdata->local;
u64 tsf;
+ if (!ieee80211_sdata_running((struct ieee80211_sub_if_data *)sdata))
+ return -ENETDOWN;
+
tsf = drv_get_tsf(local, (struct ieee80211_sub_if_data *)sdata);
return scnprintf(buf, buflen, "0x%016llx\n", (unsigned long long) tsf);
@@ -670,6 +673,9 @@ static ssize_t ieee80211_if_parse_tsf(
int ret;
int tsf_is_delta = 0;
+ if (!ieee80211_sdata_running(sdata))
+ return -ENETDOWN;
+
if (strncmp(buf, "reset", 5) == 0) {
if (local->ops->reset_tsf) {
drv_reset_tsf(local, sdata);
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 07/10] wifi: mac80211: add HE 6 GHz capability in the scan elems len
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (5 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 06/10] wifi: mac80211: don't access the TSF of a down interface Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 08/10] wifi: mac80211: mesh: reset the CSA state when leaving Johannes Berg
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+f961b9f94edbc266f1f8
From: Johannes Berg <johannes.berg@intel.com>
The HE 6 GHz Band Capability element is in the probe request for
every band if 6 GHz is supported, so add the size to scan_ies_len.
Otherwise, building probe request elements can fail, triggering the
WARN_ON in __ieee80211_start_scan().
Assisted-by: LLM
Fixes: 2ad2274c58ee ("mac80211: Add HE 6GHz capabilities element to probe request")
Reported-by: syzbot+f961b9f94edbc266f1f8@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f961b9f94edbc266f1f8
Link: https://patch.msgid.link/20260904170057.c08c4965ccd2.I5ccc4ffcbccce7e33f038bffa27bb5d215e982ee@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index a59837b9f480..6408e8464338 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -1453,6 +1453,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
sizeof(struct ieee80211_he_mcs_nss_supp) +
IEEE80211_HE_PPE_THRES_MAX_LEN;
+ if (local->hw.wiphy->bands[NL80211_BAND_6GHZ])
+ local->scan_ies_len +=
+ 3 + sizeof(struct ieee80211_he_6ghz_capa);
+
if (supp_eht)
local->scan_ies_len +=
3 + sizeof(struct ieee80211_eht_cap_elem) +
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 08/10] wifi: mac80211: mesh: reset the CSA state when leaving
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (6 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 07/10] wifi: mac80211: add HE 6 GHz capability in the scan elems len Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 09/10] wifi: mac80211: mesh: release the channel if start fails Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 10/10] wifi: mac80211: set up the TX info early to fix failure paths Johannes Berg
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+f5752cd6b94fe38be666
From: Johannes Berg <johannes.berg@intel.com>
ifmsh->csa is allocated in ieee80211_mesh_csa_beacon() and only freed
in ieee80211_mesh_finish_csa(), i.e. when the channel switch completes.
Leaving the mesh while a switch is still pending therefore leaks it.
Additionally, ifmsh->csa_role and ifmsh->chsw_ttl have their state leak
in this case, so things can get mixed up in addition to the memory
leak.
Refactor the reset and call it in ieee80211_stop_mesh() to fix it all.
Assisted-by: LLM
Reported-by: syzbot+f5752cd6b94fe38be666@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=f5752cd6b94fe38be666
Fixes: b8456a14e9d2 ("{nl,cfg,mac}80211: implement mesh channel switch userspace API")
Link: https://patch.msgid.link/20260904170057.86f8e0a996cc.Ib013eda6356cb548f29e04dfc7bf2c7a746b75a0@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/mesh.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index a35e2d5870b6..8f8814125375 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -1196,6 +1196,21 @@ int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
return 0;
}
+static void ieee80211_mesh_reset_csa(struct ieee80211_sub_if_data *sdata)
+{
+ struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
+ struct mesh_csa_settings *csa;
+
+ /* Reset the TTL value and Initiator flag */
+ ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
+ ifmsh->chsw_ttl = 0;
+
+ /* Remove the CSA and MCSP elements from the beacon */
+ csa = sdata_dereference(ifmsh->csa, sdata);
+ RCU_INIT_POINTER(ifmsh->csa, NULL);
+ kfree_rcu(csa, rcu_head);
+}
+
void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
@@ -1206,6 +1221,7 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
/* abort any running channel switch */
sdata->vif.bss_conf.csa_active = false;
+ ieee80211_mesh_reset_csa(sdata);
ieee80211_vif_unblock_queues_csa(sdata);
/* flush STAs and mpaths on this iface */
@@ -1514,19 +1530,10 @@ static void ieee80211_mesh_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata, u64 *changed)
{
- struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
- struct mesh_csa_settings *tmp_csa_settings;
- int ret = 0;
+ int ret;
- /* Reset the TTL value and Initiator flag */
- ifmsh->csa_role = IEEE80211_MESH_CSA_ROLE_NONE;
- ifmsh->chsw_ttl = 0;
+ ieee80211_mesh_reset_csa(sdata);
- /* Remove the CSA and MCSP elements from the beacon */
- tmp_csa_settings = sdata_dereference(ifmsh->csa, sdata);
- RCU_INIT_POINTER(ifmsh->csa, NULL);
- if (tmp_csa_settings)
- kfree_rcu(tmp_csa_settings, rcu_head);
ret = ieee80211_mesh_rebuild_beacon(sdata);
if (ret)
return -EINVAL;
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 09/10] wifi: mac80211: mesh: release the channel if start fails
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (7 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 08/10] wifi: mac80211: mesh: reset the CSA state when leaving Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 10/10] wifi: mac80211: set up the TX info early to fix failure paths Johannes Berg
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg, syzbot+63a84ea9c0f57d6133fa
From: Johannes Berg <johannes.berg@intel.com>
ieee80211_join_mesh() acquires a channel context and then calls
ieee80211_start_mesh(), which can fail. In that case, the chanctx
isn't released then interface removal will attempt to unassign it
after it's removed from the driver, hitting:
wlan0: Failed check-sdata-in-driver check, flags: 0x0
WARNING: net/mac80211/driver-ops.c:366 at drv_unassign_vif_chanctx
ieee80211_assign_link_chanctx
__ieee80211_link_release_channel
ieee80211_link_release_channel
ieee80211_teardown_sdata
unregister_netdevice_many_notify
_cfg80211_unregister_wdev
ieee80211_remove_interfaces
ieee80211_unregister_hw
mac80211_hwsim_del_radio
hwsim_exit_net
Correctly release the channel on start failures.
Assisted-by: LLM
Reported-by: syzbot+63a84ea9c0f57d6133fa@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=63a84ea9c0f57d6133fa
Fixes: 2b5e19677592 ("mac80211: cache mesh beacon")
Link: https://patch.msgid.link/20260904170057.8c86b0a8a44f.If6d6e31f93aca94e992ae17edc691407b146537c@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/cfg.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2d5a0abe35db..d3558f0c7550 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3323,7 +3323,11 @@ static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev,
if (err)
return err;
- return ieee80211_start_mesh(sdata);
+ err = ieee80211_start_mesh(sdata);
+ if (err)
+ ieee80211_link_release_channel(&sdata->deflink);
+
+ return err;
}
static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH RESEND wireless 10/10] wifi: mac80211: set up the TX info early to fix failure paths
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
` (8 preceding siblings ...)
2026-09-08 12:28 ` [PATCH RESEND wireless 09/10] wifi: mac80211: mesh: release the channel if start fails Johannes Berg
@ 2026-09-08 12:28 ` Johannes Berg
9 siblings, 0 replies; 11+ messages in thread
From: Johannes Berg @ 2026-09-08 12:28 UTC (permalink / raw)
To: linux-wireless; +Cc: Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
The previous commit 2c51457d930f ("wifi: mac80211: free ack status
frame on TX header build failure") cleaned up the leak, but still
left the code a bit messy and the failed SKB didn't get reported
to userspace.
Fix this up by initialising skb->cb[] earlier, which allows using
ieee80211_free_txskb() and therefore reports it for the failure
in ieee80211_build_hdr(), and unifies the ieee80211_skb_resize()
failure path with it.
Assisted-by: LLM
Fixes: c3e7724b6bc2 ("mac80211: use ieee80211_free_txskb to fix possible skb leaks")
Link: https://patch.msgid.link/20260904170057.bc197594e025.I2c7d9e50cc9abeb45b8dc1ba9411a3619cc92b10@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
net/mac80211/tx.c | 38 ++++++++++++++++++++------------------
1 file changed, 20 insertions(+), 18 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index c343ed56506a..814399989b5e 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2981,10 +2981,23 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
*/
skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb)) {
- ret = -ENOMEM;
- goto free;
+ /* skb_share_check() already freed the skb */
+ if (info_id)
+ ieee80211_remove_ack_skb(local, info_id);
+ return ERR_PTR(-ENOMEM);
}
+ /* set this up so failure paths can clean up ack skb */
+ info = IEEE80211_SKB_CB(skb);
+ memset(info, 0, sizeof(*info));
+
+ info->flags = info_flags;
+ if (info_id) {
+ info->status_data = info_id;
+ info->status_data_idr = 1;
+ }
+ info->band = band;
+
hdr.frame_control = fc;
hdr.duration_id = 0;
hdr.seq_ctrl = 0;
@@ -3023,10 +3036,8 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
head_need += local->tx_headroom;
head_need = max_t(int, 0, head_need);
if (ieee80211_skb_resize(sdata, skb, head_need, ENCRYPT_DATA)) {
- ieee80211_free_txskb(&local->hw, skb);
- skb = NULL;
ret = -ENOMEM;
- goto free;
+ goto free_txskb;
}
}
@@ -3053,16 +3064,6 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
skb_reset_mac_header(skb);
- info = IEEE80211_SKB_CB(skb);
- memset(info, 0, sizeof(*info));
-
- info->flags = info_flags;
- if (info_id) {
- info->status_data = info_id;
- info->status_data_idr = 1;
- }
- info->band = band;
-
if (likely(!cookie)) {
ctrl_flags |= u32_encode_bits(link_id,
IEEE80211_TX_CTRL_MLO_LINK);
@@ -3086,16 +3087,17 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
pre_conf_link_id, link_id);
#endif
ret = -EINVAL;
- goto free;
+ goto free_txskb;
}
}
info->control.flags = ctrl_flags;
return skb;
+ free_txskb:
+ ieee80211_free_txskb(&local->hw, skb);
+ return ERR_PTR(ret);
free:
- if (info_id)
- ieee80211_remove_ack_skb(local, info_id);
kfree_skb(skb);
return ERR_PTR(ret);
}
--
2.55.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
end of thread, other threads:[~2026-09-08 12:28 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-08 12:28 [PATCH RESEND wireless 00/10] mac80211 syzbot fixes - part 2 Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 01/10] wifi: mac80211: don't allow injecting frames wider than the chanctx Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 02/10] wifi: mac80211: reset the AP_VLAN tailroom counter on ifdown Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 03/10] wifi: mac80211: require a peer station for TDLS setup confirm Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 04/10] wifi: mac80211: don't allow link changes when iface is down Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 05/10] wifi: mac80211: don't RCU-dereference the mesh CSA settings we just set Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 06/10] wifi: mac80211: don't access the TSF of a down interface Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 07/10] wifi: mac80211: add HE 6 GHz capability in the scan elems len Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 08/10] wifi: mac80211: mesh: reset the CSA state when leaving Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 09/10] wifi: mac80211: mesh: release the channel if start fails Johannes Berg
2026-09-08 12:28 ` [PATCH RESEND wireless 10/10] wifi: mac80211: set up the TX info early to fix failure paths Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox