Skip to contentSkip to conversation

wifi: mac80211: mesh: release the channel if start fails

PATCH Superseded Alexander Martyniuk 2 participants 3 messages Oct 8 – Oct 9

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wifi: mac80211: mesh: release the channel if start fails

From: Johannes Berg <[email protected]>

commit ae97fff6495a8764bc0ef281cfe5444f701e527f upstream.

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.

---
Backport fix for CVE-2026-98326

 net/mac80211/cfg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +5 -1
index afb1ad3e6ea1..bae9588ea913 100644
@@ -2276,7 +2276,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_vif_release_channel(sdata);
+
+	return err;
 }
 
 static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
Signature · 1 line
2.43.0
#1 lore raw
Quoted 41 lines · Alexander Martyniuk

From: Johannes Berg <[email protected]>

commit ae97fff6495a8764bc0ef281cfe5444f701e527f upstream.

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.

---
Backport fix for CVE-2026-98326

 net/mac80211/cfg.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +0 -0
index afb1ad3e6ea1..bae9588ea913 100644

net/mac80211/cfg.c static int ieee80211_join_mesh(struct wiphy *wiphy, struct net_device *dev, · line 2281

Quoted 7 lines
net/mac80211/cfg.c +3 -1
@@ -2276,7 +2276,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_vif_release_channel(sdata);

In 5.10/5.15 ieee80211_vif_release_channel() requires &sdata->local->mtx to be held, it has the corresponding lockdep assertion.

Besides, the backport uses a different release-function, relevant for old kernels. I understand that's an adaptation but FWIW it's generally recommended to write a brief backporter's comment above one's SoB line if any non-trivial adaptation is done.

#2 lore raw

PATCH v2 1/1 wifi: mac80211: mesh: release the channel if start fails

From: Johannes Berg <[email protected]>

commit ae97fff6495a8764bc0ef281cfe5444f701e527f upstream.

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.

[Alexander: No such function ieee80211_link_release_channel(), so ieee80211_vif_release_channel() is used]

---
Backport fix for CVE-2026-98326

 net/mac80211/cfg.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
net/mac80211/cfg.c +8 -1
index 29bcb5f6013a..d5865f4083cf 100644
@@ -2311,7 +2311,14 @@ 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) {
+		mutex_lock(&sdata->local->mtx);
+		ieee80211_vif_release_channel(sdata);
+		mutex_unlock(&sdata->local->mtx);
+	}
+
+	return err;
 }
 
 static int ieee80211_leave_mesh(struct wiphy *wiphy, struct net_device *dev)
Signature · 1 line
2.43.0