@@ -218,6 +218,18 @@ static int tbl_mask_array_realloc(struct flow_table *tbl, int size)
return 0;
}
+static void tbl_mask_array_destroy(struct flow_table *tbl)
+{
+ struct mask_array *ma = ovsl_dereference(tbl->mask_array);
+ int i;
+
+ /* Free the flow-mask and kfree_rcu the NULL is allowed. */
+ for (i = 0; i < ma->count; i++)
+ kfree_rcu(ma->masks[i], rcu);
+
+ kfree_rcu(tbl->mask_array, rcu);
+}
+
int ovs_flow_tbl_init(struct flow_table *table)
{
struct table_instance *ti, *ufid_ti;
@@ -312,7 +324,7 @@ void ovs_flow_tbl_destroy(struct flow_table *table)
struct table_instance *ufid_ti = rcu_dereference_raw(table->ufid_ti);
free_percpu(table->mask_cache);
- kfree(rcu_dereference_raw(table->mask_array));
+ tbl_mask_array_destroy(table);
table_instance_destroy(ti, ufid_ti, false);
}