Thread (10 messages) flat view 10 messages, 3 authors, 2020-09-01

Re: [PATCH net-next v2 2/3] net: openvswitch: refactor flow free function

From: Tonghao Zhang <hidden>
Date: 2020-08-24 13:58:45
Subsystem: networking [general], openvswitch, the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Aaron Conole, Eelco Chaudron, Ilya Maximets, Linus Torvalds

On Mon, Aug 24, 2020 at 9:09 PM David Miller [off-list ref] wrote:
From: xiangxia.m.yue@gmail.com
Date: Mon, 24 Aug 2020 15:36:01 +0800
quoted
To avoid a bug when deleting flows in the future, add
BUG_ON in flush flows function.
BUG_ON() is too severe, I think WARN_ON() or similar are sufficient
because the kernel can try to continue operating if this condition is
detected.

And you can force the values to zero in such a situation.
Thanks, David
will be changed to:
diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c
index 0473758035b5..5378282e1d13 100644
--- a/net/openvswitch/flow_table.c
+++ b/net/openvswitch/flow_table.c
@@ -492,8 +492,11 @@ void table_instance_flow_flush(struct flow_table *table,
                }
        }

-       BUG_ON(table->count != 0);
-       BUG_ON(table->ufid_count != 0);
+       if (WARN_ON(table->count != 0 ||
+                   table->ufid_count != 0)) {
+               table->count = 0;
+               table->ufid_count = 0
+       }
 }
Thank you.


-- 
Best regards, Tonghao
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help