net: openvswitch: use hlist_for_each_entry_rcu instead of hlist_for_each_entry
authorTonghao Zhang <xiangxia.m.yue@gmail.com>
Wed, 25 Mar 2020 20:27:24 +0000 (04:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Apr 2020 00:48:12 +0000 (17:48 -0700)
The struct sw_flow is protected by RCU, when traversing them,
use hlist_for_each_entry_rcu.

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Tested-by: Greg Rose <gvrose8192@gmail.com>
Reviewed-by: Greg Rose <gvrose8192@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/flow_table.c

index fd8a01c..2398d72 100644 (file)
@@ -462,12 +462,14 @@ static void flow_table_copy_flows(struct table_instance *old,
                struct hlist_head *head = &old->buckets[i];
 
                if (ufid)
-                       hlist_for_each_entry(flow, head,
-                                            ufid_table.node[old_ver])
+                       hlist_for_each_entry_rcu(flow, head,
+                                                ufid_table.node[old_ver],
+                                                lockdep_ovsl_is_held())
                                ufid_table_instance_insert(new, flow);
                else
-                       hlist_for_each_entry(flow, head,
-                                            flow_table.node[old_ver])
+                       hlist_for_each_entry_rcu(flow, head,
+                                                flow_table.node[old_ver],
+                                                lockdep_ovsl_is_held())
                                table_instance_insert(new, flow);
        }