Use LIST_FOR_EACH_SAFE, not LIST_FOR_EACH, when deleting from a list.
authorBen Pfaff <blp@nicira.com>
Mon, 31 Mar 2008 20:46:39 +0000 (13:46 -0700)
committerBen Pfaff <blp@nicira.com>
Tue, 1 Apr 2008 16:52:59 +0000 (09:52 -0700)
switch/table-mac.c

index cfcd72fa189622511e892da386df35b161bd2383..6686477ea0de4f9023a0782c624a38308c999699 100644 (file)
@@ -126,8 +126,8 @@ static int table_mac_delete(struct sw_table *swt,
         int count = 0;
         for (i = 0; i <= tm->bucket_mask; i++) {
             struct list *bucket = &tm->buckets[i];
-            struct sw_flow *flow;
-            LIST_FOR_EACH (flow, struct sw_flow, node, bucket) {
+            struct sw_flow *flow, *next;
+            LIST_FOR_EACH_SAFE (flow, next, struct sw_flow, node, bucket) {
                 if (flow_del_matches(&flow->key, key, strict)) {
                     do_delete(flow);
                     count++;
@@ -147,8 +147,8 @@ static int table_mac_timeout(struct datapath *dp, struct sw_table *swt)
 
     for (i = 0; i <= tm->bucket_mask; i++) {
         struct list *bucket = &tm->buckets[i];
-        struct sw_flow *flow;
-        LIST_FOR_EACH (flow, struct sw_flow, node, bucket) {
+        struct sw_flow *flow, *next;
+        LIST_FOR_EACH_SAFE (flow, next, struct sw_flow, node, bucket) {
             if (flow_timeout(flow)) {
                 dp_send_flow_expired(dp, flow);
                 do_delete(flow);