From: Ben Pfaff Date: Thu, 31 Mar 2011 21:11:57 +0000 (-0700) Subject: ofproto: Fix order of destruction in ofproto_destroy(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f41240e6f32f1162132d4f307e95e4d452e24a0f;p=openvswitch ofproto: Fix order of destruction in ofproto_destroy(). 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 --- diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 6994b117..7cdc98ad 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -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);