Skip to contentSkip to conversation

bridge: mcast: Synchronously shutdown port multicast timers

PATCH Applied Ido Schimmel 2 participants 2 messages Jun 3 – Jun 5

Subsystems (3)
lore
Share & tools
lore

Ido Schimmel

author maintainer
#0 lore raw

PATCH 1/1 bridge: mcast: Synchronously shutdown port multicast timers

Currently, while four timers are set up during port multicast context initialization, only two are synchronously deleted when the context is de-initialized, just before being deleted.

This is fine because the structure containing the multicast context (either a bridge port or a VLAN) is only deleted after an RCU grace period and it will not pass as long as the timers are executing. These timers are also not supposed to do any work at this stage. They acquire the bridge multicast lock, see that the multicast context was disabled and exit.

Make the code more explicit and symmetric and synchronously shutdown all four timers when the multicast context is de-initialized. Use timer_shutdown_sync() to guarantee that the timers will not be re-armed given that the containing structure is being deleted.

---
 net/bridge/br_multicast.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
net/bridge/br_multicast.c +4 -2
index 5d6fdfb43c04..c2c93c740415 100644
@@ -2027,9 +2027,11 @@ void br_multicast_port_ctx_deinit(struct net_bridge_mcast_port *pmctx)
 	bool del = false;
 
 #if IS_ENABLED(CONFIG_IPV6)
-	timer_delete_sync(&pmctx->ip6_mc_router_timer);
+	timer_shutdown_sync(&pmctx->ip6_own_query.timer);
+	timer_shutdown_sync(&pmctx->ip6_mc_router_timer);
 #endif
-	timer_delete_sync(&pmctx->ip4_mc_router_timer);
+	timer_shutdown_sync(&pmctx->ip4_own_query.timer);
+	timer_shutdown_sync(&pmctx->ip4_mc_router_timer);
 
 	spin_lock_bh(&br->multicast_lock);
 	del |= br_ip6_multicast_rport_del(pmctx);
Signature · 1 line
2.54.0
#1 lore raw
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 4 lines · On Wed, 3 Jun 2026 13:35:22 +0300 you wrote:

Currently, while four timers are set up during port multicast context initialization, only two are synchronously deleted when the context is de-initialized, just before being deleted.

Quoted 8 lines

This is fine because the structure containing the multicast context (either a bridge port or a VLAN) is only deleted after an RCU grace period and it will not pass as long as the timers are executing. These timers are also not supposed to do any work at this stage. They acquire the bridge multicast lock, see that the multicast context was disabled and exit.

[...]

Here is the summary with links:
- [net-next] bridge: mcast: Synchronously shutdown port multicast timers

    https://git.kernel.org/netdev/net-next/c/7a188fcc18d4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html