Netdev List
 help / color / mirror / Atom feed
* [PATCH 5.10/5.15] wifi: mac80211: mesh: release the channel if start fails
@ 2026-10-08 11:51 Alexander Martyniuk
  2026-10-08 19:19 ` Fedor Pchelkin
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Martyniuk @ 2026-10-08 11:51 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Alexander Martyniuk, Johannes Berg, David S. Miller,
	Jakub Kicinski, Thomas Pedersen, linux-wireless, netdev,
	linux-kernel, lvc-project, syzbot+63a84ea9c0f57d6133fa,
	Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

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.

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/20260908122838.201719-21-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Alexander Martyniuk <alexevgmart@gmail.com>
---
Backport fix for CVE-2026-98326
 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 afb1ad3e6ea1..bae9588ea913 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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)
-- 
2.43.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 5.10/5.15] wifi: mac80211: mesh: release the channel if start fails
  2026-10-08 11:51 [PATCH 5.10/5.15] wifi: mac80211: mesh: release the channel if start fails Alexander Martyniuk
@ 2026-10-08 19:19 ` Fedor Pchelkin
  2026-10-09 12:39   ` [PATCH 5.10/5.15 v2] " Alexander Martyniuk
  0 siblings, 1 reply; 3+ messages in thread
From: Fedor Pchelkin @ 2026-10-08 19:19 UTC (permalink / raw)
  To: Alexander Martyniuk
  Cc: stable, Greg Kroah-Hartman, lvc-project, Johannes Berg,
	Thomas Pedersen, linux-wireless, linux-kernel,
	syzbot+63a84ea9c0f57d6133fa, netdev, Jakub Kicinski,
	Johannes Berg, David S. Miller

On Thu, 08. Oct 14:51, Alexander Martyniuk wrote:
> From: Johannes Berg <johannes.berg@intel.com>
> 
> 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.
> 
> 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/20260908122838.201719-21-johannes@sipsolutions.net
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Alexander Martyniuk <alexevgmart@gmail.com>
> ---
> Backport fix for CVE-2026-98326
>  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 afb1ad3e6ea1..bae9588ea913 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 5.10/5.15 v2] wifi: mac80211: mesh: release the channel if start fails
  2026-10-08 19:19 ` Fedor Pchelkin
@ 2026-10-09 12:39   ` Alexander Martyniuk
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Martyniuk @ 2026-10-09 12:39 UTC (permalink / raw)
  To: pchelkin, stable, Greg Kroah-Hartman
  Cc: alexevgmart, davem, johannes.berg, johannes, kuba, linux-kernel,
	linux-wireless, lvc-project, netdev, syzbot+63a84ea9c0f57d6133fa,
	thomas

From: Johannes Berg <johannes.berg@intel.com>

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.

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/20260908122838.201719-21-johannes@sipsolutions.net
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
[Alexander: No such function ieee80211_link_release_channel(), so
ieee80211_vif_release_channel() is used]
Signed-off-by: Alexander Martyniuk <alexevgmart@gmail.com>
---
Backport fix for CVE-2026-98326
 net/mac80211/cfg.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 29bcb5f6013a..d5865f4083cf 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -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)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-09 12:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-08 11:51 [PATCH 5.10/5.15] wifi: mac80211: mesh: release the channel if start fails Alexander Martyniuk
2026-10-08 19:19 ` Fedor Pchelkin
2026-10-09 12:39   ` [PATCH 5.10/5.15 v2] " Alexander Martyniuk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox