rstp: Properly disable an RSTP port before deleting it.
authorJarno Rajahalme <jrajahalme@nicira.com>
Tue, 29 Sep 2015 20:38:28 +0000 (13:38 -0700)
committerJarno Rajahalme <jrajahalme@nicira.com>
Mon, 12 Oct 2015 18:34:51 +0000 (11:34 -0700)
RSTP may end up referencing stale memory if a port is removed without
disabling it first.

This patch, together with the previous patch by Daniele Venturino, was
tested to resolve a crach by Daniel Swahn.

Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com>
Tested-by: Daniel Swahn <daniel.swahn@clavister.com>
ofproto/ofproto-dpif.c

index 7b46f0f..90890b9 100644 (file)
@@ -2543,8 +2543,11 @@ set_rstp_port(struct ofport *ofport_,
 
     if (!s || !s->enable) {
         if (rp) {
-            rstp_port_unref(rp);
+            rstp_port_set_aux(rp, NULL);
+            rstp_port_set_state(rp, RSTP_DISABLED);
+            rstp_port_set_mac_operational(rp, false);
             ofport->rstp_port = NULL;
+            rstp_port_unref(rp);
             update_rstp_port_state(ofport);
         }
         return;