Skip to contentSkip to conversation

net: bridge: disable multicast while delete bridge

PATCH NAK Menglong Dong 2 participants 3 messages Nov 2, 2020 – Nov 4, 2020

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

PATCH 1/1 net: bridge: disable multicast while delete bridge

From: Menglong Dong <[email protected]>

This commit seems make no sense, as bridge is destroyed when br_multicast_dev_del is called.

In commit b1b9d366028f
("bridge: move bridge multicast cleanup to ndo_uninit"), Xin Long fixed the use-after-free panic in br_multicast_group_expired by moving br_multicast_dev_del to ndo_uninit. However, that patch is not applied to 4.4.X, and the bug exists.

Fix that bug by disabling multicast in br_multicast_dev_del for 4.4.X, and there is no harm for other branches.

---
 net/bridge/br_multicast.c | 1 +
 1 file changed, 1 insertion(+)
net/bridge/br_multicast.c +1 -0
index eae898c3cff7..9992fdff2951 100644
@@ -3369,6 +3369,7 @@ void br_multicast_dev_del(struct net_bridge *br)
 	hlist_for_each_entry_safe(mp, tmp, &br->mdb_list, mdb_node)
 		br_multicast_del_mdb_entry(mp);
 	hlist_move_list(&br->mcast_gc_list, &deleted_head);
+	br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
 	spin_unlock_bh(&br->multicast_lock);
 
 	br_multicast_gc(&deleted_head);
Signature · 1 line
2.25.1
Nacked-by on v1 1/1 NAK
#1 lore raw
Quoted 24 lines · Menglong Dong

From: Menglong Dong <[email protected]>

This commit seems make no sense, as bridge is destroyed when br_multicast_dev_del is called.

In commit b1b9d366028f
("bridge: move bridge multicast cleanup to ndo_uninit"), Xin Long fixed the use-after-free panic in br_multicast_group_expired by moving br_multicast_dev_del to ndo_uninit. However, that patch is not applied to 4.4.X, and the bug exists.

Fix that bug by disabling multicast in br_multicast_dev_del for 4.4.X, and there is no harm for other branches.

---
 net/bridge/br_multicast.c | 1 +
 1 file changed, 1 insertion(+)
net/bridge/br_multicast.c +0 -0
index eae898c3cff7..9992fdff2951 100644

net/bridge/br_multicast.c void br_multicast_dev_del(struct net_bridge *br) · line 3375

Quoted 7 lines
net/bridge/br_multicast.c +1 -0
@@ -3369,6 +3369,7 @@ void br_multicast_dev_del(struct net_bridge *br)
 	hlist_for_each_entry_safe(mp, tmp, &br->mdb_list, mdb_node)
 		br_multicast_del_mdb_entry(mp);
 	hlist_move_list(&br->mcast_gc_list, &deleted_head);
+	br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
 	spin_unlock_bh(&br->multicast_lock);
 
 	br_multicast_gc(&deleted_head);

This doesn't make any sense. It doesn't fix anything.
If 4.4 has a problem then the relevant patches should get backported to it. We don't add random changes to fix older releases.

Cheers,
Nik

#2 lore raw

Dear Nik,

Quoted 38 lines · Nikolay Aleksandrov
Quoted 24 lines · Menglong Dong

From: Menglong Dong <[email protected]>

This commit seems make no sense, as bridge is destroyed when br_multicast_dev_del is called.

In commit b1b9d366028f
("bridge: move bridge multicast cleanup to ndo_uninit"), Xin Long fixed the use-after-free panic in br_multicast_group_expired by moving br_multicast_dev_del to ndo_uninit. However, that patch is not applied to 4.4.X, and the bug exists.

Fix that bug by disabling multicast in br_multicast_dev_del for 4.4.X, and there is no harm for other branches.

---
 net/bridge/br_multicast.c | 1 +
 1 file changed, 1 insertion(+)
net/bridge/br_multicast.c +0 -0
index eae898c3cff7..9992fdff2951 100644

net/bridge/br_multicast.c void br_multicast_dev_del(struct net_bridge *br) · line 3375

Quoted 7 lines
net/bridge/br_multicast.c +1 -0
@@ -3369,6 +3369,7 @@ void br_multicast_dev_del(struct net_bridge *br)
      hlist_for_each_entry_safe(mp, tmp, &br->mdb_list, mdb_node)
              br_multicast_del_mdb_entry(mp);
      hlist_move_list(&br->mcast_gc_list, &deleted_head);
+     br_opt_toggle(br, BROPT_MULTICAST_ENABLED, false);
      spin_unlock_bh(&br->multicast_lock);
 
      br_multicast_gc(&deleted_head);

This doesn't make any sense. It doesn't fix anything.
If 4.4 has a problem then the relevant patches should get backported to it. We don't add random changes to fix older releases.

Quoted 4 lines

Cheers,
Nik

Thanks for your patient explanation, and I see it now~

Cheers,
Menglong Dong