Skip to contentSkip to conversation

mac802154: wait for RCU readers when removing interfaces

PATCH In review Yousef Alhouseen 4 participants 6 messages Jun 30 – Jul 3

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

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.

Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")
Reported-by [email protected]
---
 net/mac802154/iface.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac802154/iface.c +2 -1
index 000be60d9580..73d82a015184 100644
@@ -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
#1 lore raw

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->interfaces under RCU. The bulk hardware teardown path removes entries with list_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(): use list_del_rcu() and wait for existing readers before unregistering each interface.

Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")
Reported-by [email protected]
---
 net/mac802154/iface.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac802154/iface.c +2 -1
index 000be60d9580..73d82a015184 100644
@@ -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);
 	}
#2 lore raw

PATCH v2 1/1 mac802154: remove interfaces with RCU list deletion

In reply to Yousef Alhouseen

Queue 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.

Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")
Reported-by [email protected]

---
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
index 000be60d9580..b823720630e7 100644
@@ -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
Reviewed-by on v2 1/1
#3 lore raw

Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion

Quoted 10 lines · Yousef Alhouseen

Queue 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.

Quoted 5 lines
Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")
Reported-by [email protected]
maintainer Reviewed-by on v2 1/1
#4 lore raw

Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion

In reply to Yousef Alhouseen

Hello,

Quoted 9 lines

Queue 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.

Quoted 5 lines
Fixes 592dfbfc72f5 ("mac820154: move interface unregistration into iface")
Reported-by [email protected]

FWIU, looks correct.

Thanks,
Miquèl

#5 lore raw

Re: [PATCH net v2] mac802154: remove interfaces with RCU list deletion

In reply to Yousef Alhouseen
This 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->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.

[...]

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