mac802154: wait for RCU readers when removing interfaces
Subsystems (4)
PATCH 1/1 mac802154: wait for RCU readers when removing interfaces
Queue wake, stop, and disable paths walk local->interfaces under RCU. The bulk hardware teardown path removes entries with list_del() and immediately unregisters their netdevices, so an asynchronous transmit completion can follow a poisoned list node in ieee802154_wake_queue().
Match ieee802154_if_remove(): use list_del_rcu() and wait for existing readers before unregistering each interface.
--- net/mac802154/iface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac802154/iface.c +2 -1
@@ -703,7 +703,8 @@ void ieee802154_remove_interfaces(struct ieee802154_local *local)mutex_lock (&local->iflist_mtx);list_for_each_entry_safe (sdata, tmp, &local->interfaces, list) { -list_del (&sdata->list); +list_del_rcu (&sdata->list); +synchronize_rcu ();unregister_netdevice (sdata->dev); }
Signature · 1 line
2.55.0
From: Yousef Alhouseen <[email protected]>
Date: Tue, 30 Jun 2026 23:18:08 +0200
Quoted 2 lines
Queue wake, stop, and disable paths walk
local->interfacesunder RCU. The bulk hardware teardown path removes entries withlist_del()and
The problematic part is list_del(), not unregister_netdevice().
Quoted 1 line
immediately unregisters their netdevices, so an asynchronous transmit
not immediately, unregister_netdevice() waits inflight RCU readers. So, synchronize_rcu() should be unnecessary.
(Same remark for ieee802154_if_remove())
Quoted 29 lines
completion can follow a poisoned list node in
ieee802154_wake_queue().Match
ieee802154_if_remove(): uselist_del_rcu()and wait for existing readers before unregistering each interface.Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")Reported-by [email protected]Signed-off-by Yousef Alhouseen <[email protected]>--- net/mac802154/iface.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)net/mac802154/iface.c +2
-1@@ -703,7 +703,8 @@ void ieee802154_remove_interfaces(struct ieee802154_local *local)mutex_lock (&local->iflist_mtx);list_for_each_entry_safe (sdata, tmp, &local->interfaces, list) { -list_del (&sdata->list); +list_del_rcu (&sdata->list); +synchronize_rcu ();unregister_netdevice (sdata->dev); }
PATCH v2 1/1 mac802154: remove interfaces with RCU list deletion
In reply to Yousef AlhouseenQueue wake, stop, and disable paths walk local->interfaces under RCU. The bulk hardware teardown path removes entries with list_del(), so an asynchronous transmit completion can follow a poisoned list node in ieee802154_wake_queue().
Use list_del_rcu() as in the single-interface removal path. The following unregister_netdevice() waits for in-flight RCU readers before freeing the netdevice, so no separate grace-period wait is needed.
---
Changes in v2:
- Drop the redundant synchronize_rcu() noted by Kuniyuki Iwashima.
- Clarify that unregister_netdevice() supplies the required RCU wait.
- Narrow the subject and commit message to the list deletion bug.
net/mac802154/iface.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac802154/iface.c +1 -1
@@ -703,7 +703,7 @@ void ieee802154_remove_interfaces(struct ieee802154_local *local)mutex_lock (&local->iflist_mtx);list_for_each_entry_safe (sdata, tmp, &local->interfaces, list) { -list_del (&sdata->list); +list_del_rcu (&sdata->list);unregister_netdevice (sdata->dev); }
Signature · 1 line
2.55.0
Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion
Quoted 10 lines · Yousef Alhouseen
Queue wake, stop, and disable paths walk
local->interfacesunder RCU. The bulk hardware teardown path removes entries withlist_del(), so an asynchronous transmit completion can follow a poisoned list node inieee802154_wake_queue().Use
list_del_rcu()as in the single-interface removal path. The followingunregister_netdevice()waits for in-flight RCU readers before freeing the netdevice, so no separate grace-period wait is needed.
Quoted 5 lines
Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")Reported-by [email protected]Signed-off-by Yousef Alhouseen <[email protected]>
Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion
In reply to Yousef AlhouseenHello,
Quoted 9 lines
Queue wake, stop, and disable paths walk
local->interfacesunder RCU. The bulk hardware teardown path removes entries withlist_del(), so an asynchronous transmit completion can follow a poisoned list node inieee802154_wake_queue().Use
list_del_rcu()as in the single-interface removal path. The followingunregister_netdevice()waits for in-flight RCU readers before freeing the netdevice, so no separate grace-period wait is needed.
Quoted 5 lines
Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")Reported-by [email protected]Signed-off-by Yousef Alhouseen <[email protected]>
FWIU, looks correct.
Thanks,
Miquèl
Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion
In reply to Yousef AlhouseenThis patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 10 lines · On Wed, 1 Jul 2026 18:42:22 +0200 you wrote:
Queue wake, stop, and disable paths walk
local->interfacesunder RCU. The bulk hardware teardown path removes entries withlist_del(), so an asynchronous transmit completion can follow a poisoned list node inieee802154_wake_queue().Use
list_del_rcu()as in the single-interface removal path. The followingunregister_netdevice()waits for in-flight RCU readers before freeing the netdevice, so no separate grace-period wait is needed.[...]
Here is the summary with links:
- [net,v2] mac802154: remove interfaces with RCU list deletion
https://git.kernel.org/netdev/net/c/539dfcf69105
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html