Skip to contentSkip to conversation

bridge: avoid OOPS if root port not found

PATCH Applied Stephen Hemminger 2 participants 2 messages Apr 30, 2013

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

PATCH 1/1 bridge: avoid OOPS if root port not found

Bridge can crash while trying to send topology change packet. This happens if root port can't be found. This was reported by user but currently unable to reproduce it easily. The STP conditions that cause this are not known yet, but the problem doesn't have to be fatal.

net/bridge/br_stp.c +8 -1
@@ -225,7 +225,14 @@ static void br_record_config_timeout_val
 /* called under bridge lock */
 void br_transmit_tcn(struct net_bridge *br)
 {
-	br_send_tcn_bpdu(br_get_port(br, br->root_port));
+	struct net_bridge_port *p;
+
+	p = br_get_port(br, br->root_port);
+	if (p)
+		br_send_tcn_bpdu(p);
+	else
+		br_notice(br, "root port %u not found for topology notice\n",
+			  br->root_port);
 }
 
 /* called under bridge lock */
maintainer Applied
#1 lore raw

From: Stephen Hemminger <[email protected]>
Date: Tue, 30 Apr 2013 08:29:27 -0700

Quoted 6 lines

Bridge can crash while trying to send topology change packet. This happens if root port can't be found. This was reported by user but currently unable to reproduce it easily. The STP conditions that cause this are not known yet, but the problem doesn't have to be fatal.

Right, there's no reason we should flat-out crash because of this.

Applied, thanks.