From: stephen hemminger Date: Tue, 30 Apr 2013 05:29:27 +0000 (+0000) Subject: bridge: avoid OOPS if root port not found X-Git-Tag: firefly_0821_release~3680^2~614^2~10 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=91bc033c4d01656e3d8e45a13fd58924a3099693;p=firefly-linux-kernel-4.4.55.git 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. Signed-off-by: Stephen Hemminger Signed-off-by: David S. Miller --- diff --git a/net/bridge/br_stp.c b/net/bridge/br_stp.c index b01849a74310..1c0a50f13229 100644 --- a/net/bridge/br_stp.c +++ b/net/bridge/br_stp.c @@ -225,7 +225,14 @@ static void br_record_config_timeout_values(struct net_bridge *br, /* 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 */