ofproto: Fix order of destruction in ofproto_destroy().
authorBen Pfaff <blp@nicira.com>
Thu, 31 Mar 2011 21:11:57 +0000 (14:11 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 31 Mar 2011 21:28:42 +0000 (14:28 -0700)
ofproto_flush_flows() calls into the connmgr (via connmgr_flushed()) so
it must be called before destroying the connmgr to avoid a use-after-free
error.

Bug #5231.
Reported-by: Krishna Miriyala <krishna@nicira.com>
ofproto/ofproto.c

index 6994b1172d829314f13f7e4785e0267a572a3eac..7cdc98adf2111d795e11951295f167e940f25b3c 100644 (file)
@@ -683,10 +683,8 @@ ofproto_destroy(struct ofproto *p)
 
     shash_find_and_delete(&all_ofprotos, dpif_name(p->dpif));
 
-    /* Destroy connmgr early, since it touches the classifier. */
-    connmgr_destroy(p->connmgr);
-
     ofproto_flush_flows(p);
+    connmgr_destroy(p->connmgr);
     classifier_destroy(&p->cls);
     hmap_destroy(&p->facets);