All Virtuozzo development lists (kernel + QEMU)
 help / color / mirror / Atom feed
* [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge
@ 2026-09-11 17:37 Konstantin Khorenko
  2026-09-14  8:14 ` Vasileios Almpanis
  2026-09-14 10:58 ` Konstantin Khorenko
  0 siblings, 2 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-09-11 17:37 UTC (permalink / raw)
  To: Vasileios Almpanis, OpenVZ devel list; +Cc: Denis V. Lunev

From: Ido Schimmel <idosch@nvidia.com>

The three STP timers are not supposed to be armed while the bridge is
administratively down. They are synchronously deactivated when the
bridge is put administratively down and the various call sites check for
'IFF_UP' before arming them.

This check is missing from br_topology_change_detection() and it is
possible to engineer a situation in which the topology change timer is
armed while the bridge is administratively down, resulting in a
use-after-free [1] when the bridge is deleted.

Fix by adding the missing check and for good measures synchronously
shutdown the three timers when the bridge is deleted.

[1]
ODEBUG: free active (active state 0) object: ffff88811662b9b0 object type: timer_list hint: br_topology_change_timer_expired (net/bridge/br_stp_timer.c:120)
WARNING: lib/debugobjects.c:629 at debug_print_object+0x1bc/0x450, CPU#9: ip/359

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Noam Rathaus <noamr@ssd-disclosure.com>
Reported-by: Neil Young <contact@ssd-disclosure.com>
Acked-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Breno Leitao <leitao@debian.org>
Link: https://patch.msgid.link/20260629072117.497959-1-idosch@nvidia.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>

(cherry picked from commit 2a00517db8de4be7df3d483b215c5544fb30a191)
https://virtuozzo.atlassian.net/browse/VSTOR-145092
Feature: fix ms/net

Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 net/bridge/br_if.c  | 3 +++
 net/bridge/br_stp.c | 3 ++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index b7bf3e0aced66..0fa4d5362d041 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -391,6 +391,9 @@ void br_dev_delete(struct net_device *dev, struct list_head *head)
 
 	br_fdb_delete_by_port(br, NULL, 0, 1);
 
+	timer_shutdown_sync(&br->hello_timer);
+	timer_shutdown_sync(&br->topology_change_timer);
+	timer_shutdown_sync(&br->tcn_timer);
 	cancel_delayed_work_sync(&br->gc_work);
 
 	br_sysfs_delbr(br->dev);
diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c
index 024210f954683..76a2df165ffc8 100644
--- a/net/bridge/br_stp.c
+++ b/net/bridge/br_stp.c
@@ -371,7 +371,8 @@ void br_topology_change_detection(struct net_bridge *br)
 {
 	int isroot = br_is_root_bridge(br);
 
-	if (br->stp_enabled != BR_KERNEL_STP)
+	if (br->stp_enabled != BR_KERNEL_STP ||
+	    !(br->dev->flags & IFF_UP))
 		return;
 
 	br_info(br, "topology change detected, %s\n",
-- 
2.43.0

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge
  2026-09-11 17:37 [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge Konstantin Khorenko
@ 2026-09-14  8:14 ` Vasileios Almpanis
  2026-09-14 10:58 ` Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: Vasileios Almpanis @ 2026-09-14  8:14 UTC (permalink / raw)
  To: Konstantin Khorenko; +Cc: Denis V. Lunev, OpenVZ devel list

On Fri, 11 Sep 2026 19:37:52 +0200, Konstantin Khorenko <khorenko@virtuozzo.com> wrote:
> The three STP timers are not supposed to be armed while the bridge is
> administratively down. They are synchronously deactivated when the
> bridge is put administratively down and the various call sites check for
> 'IFF_UP' before arming them.
> 
> This check is missing from br_topology_change_detection() and it is
> possible to engineer a situation in which the topology change timer is
> armed while the bridge is administratively down, resulting in a
> use-after-free [1] when the bridge is deleted.
> 
> [...]

Reviewed-by: Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>

-- 
Vasileios Almpanis <vasileios.almpanis@virtuozzo.com>
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

* Re: [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge
  2026-09-11 17:37 [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge Konstantin Khorenko
  2026-09-14  8:14 ` Vasileios Almpanis
@ 2026-09-14 10:58 ` Konstantin Khorenko
  1 sibling, 0 replies; 3+ messages in thread
From: Konstantin Khorenko @ 2026-09-14 10:58 UTC (permalink / raw)
  To: Vasileios Almpanis, OpenVZ devel list, Konstantin Khorenko; +Cc: Denis V. Lunev

On Fri, 11 Sep 2026 19:37:52 +0200, Konstantin Khorenko wrote:
> bridge: stp: Fix a potential use-after-free when deleting a bridge

Applied to branch-rh10-6.12.0-211.52.1.20.x.vz10-ovz, will be released in rh10-6.12.0-211.52.1.20.4.vz10, thanks!

[1/1] bridge: stp: Fix a potential use-after-free when deleting a bridge
      https://bitbucket.org/virtuozzocore/vzkernel.vzs/commits/ef994d2c62a1

-- 
Konstantin Khorenko <khorenko@virtuozzo.com>

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

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

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 17:37 [Devel] [PATCH vz10] bridge: stp: Fix a potential use-after-free when deleting a bridge Konstantin Khorenko
2026-09-14  8:14 ` Vasileios Almpanis
2026-09-14 10:58 ` Konstantin Khorenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.