Use list_for_each_safe() to iter over l2flow_table
abm_br_even() iterates over elements in l2flow_table[i]. Under certain
conditions, the loop body calls list_del() on the current element which
must not be done if list_for_each() is used. Let's use
list_for_each_safe() instead as it saves pointers to the previous and
next element. Therefore, the current element can be deleted safely.
Change-Id: I5f917098a743d2f1b88b01c9ec20f70bb6d6de17
diff --git a/auto_bridge/auto_bridge.c b/auto_bridge/auto_bridge.c
index 908cbb3..acb8ffd 100644
--- a/auto_bridge/auto_bridge.c
+++ b/auto_bridge/auto_bridge.c
@@ -196,12 +196,12 @@
if (event == BREVENT_PORT_DOWN) {
struct net_device * dev = (struct net_device *) ptr;
int i;
- struct list_head *entry;
+ struct list_head *entry, *tmp;
struct l2flowTable *table_entry;
for (i = 0; i < L2FLOW_HASH_TABLE_SIZE; i++) {
spin_lock_bh(&abm_lock);
- list_for_each(entry, &l2flow_table[i]) {
+ list_for_each_safe(entry, tmp, &l2flow_table[i]) {
table_entry = container_of(entry, struct l2flowTable, list);
if ((table_entry->state != L2FLOW_STATE_DYING)
&& ((table_entry->idev_ifi == dev->ifindex) || (table_entry->odev_ifi == dev->ifindex))){