openvswitch: Fix ovs_flow_free() ovs-lock assert.
authorPravin B Shelar <pshelar@nicira.com>
Fri, 31 Jan 2014 17:43:23 +0000 (09:43 -0800)
committerJesse Gross <jesse@nicira.com>
Wed, 5 Feb 2014 06:21:45 +0000 (22:21 -0800)
ovs_flow_free() is not called under ovs-lock during packet
execute path (ovs_packet_cmd_execute()). Since packet execute
does not touch flow->mask, there is no need to take that
lock either. So move assert in case where flow->mask is checked.

Found by code inspection.

Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
net/openvswitch/flow_table.c

index bd14052ed3420d2f7c3f3c636000e9822476f253..3c268b3d71c34baa0a8c70888823b37da454fffd 100644 (file)
@@ -158,11 +158,13 @@ void ovs_flow_free(struct sw_flow *flow, bool deferred)
        if (!flow)
                return;
 
-       ASSERT_OVSL();
-
        if (flow->mask) {
                struct sw_flow_mask *mask = flow->mask;
 
+               /* ovs-lock is required to protect mask-refcount and
+                * mask list.
+                */
+               ASSERT_OVSL();
                BUG_ON(!mask->ref_count);
                mask->ref_count--;