ofproto: Don't destroy mutex before its use.
authorGurucharan Shetty <gshetty@nicira.com>
Tue, 22 Apr 2014 17:18:02 +0000 (10:18 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Fri, 25 Apr 2014 14:48:25 +0000 (07:48 -0700)
Currently, we are calling guarded_list_destroy()
to destroy a mutex and then go ahead and use it through
delete_group
 ->delete_group__
   ->handle_flow_mod__
    ->run_rule_executes
     ->guarded_list_pop_all

The group related unit tests cause ovs-vswitchd to crash
because of this (on windows).

Calling guarded_list_destroy() after delete_group() solves the
problem.

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
ofproto/ofproto.c

index 659990e..49444c1 100644 (file)
@@ -1311,9 +1311,9 @@ ofproto_destroy__(struct ofproto *ofproto)
     ovs_assert(list_is_empty(&ofproto->pending));
 
     destroy_rule_executes(ofproto);
     ovs_assert(list_is_empty(&ofproto->pending));
 
     destroy_rule_executes(ofproto);
-    guarded_list_destroy(&ofproto->rule_executes);
-
     delete_group(ofproto, OFPG_ALL);
     delete_group(ofproto, OFPG_ALL);
+
+    guarded_list_destroy(&ofproto->rule_executes);
     ovs_rwlock_destroy(&ofproto->groups_rwlock);
     hmap_destroy(&ofproto->groups);
 
     ovs_rwlock_destroy(&ofproto->groups_rwlock);
     hmap_destroy(&ofproto->groups);