Commit 99f47ea4 authored by David S. Miller's avatar David S. Miller

Merge branch 'nfp-ct-fixes'

Simon Horman says:

====================
small tc conntrack fixes

Louis Peens says:

The first patch makes sure that any callbacks registered to
the ct->nf_tables table are cleaned up before freeing.

The second patch removes what was effectively a workaround
in the nfp driver because of the missing cleanup in patch 1.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents a019abd8 7cc93d88
...@@ -1141,20 +1141,7 @@ int nfp_fl_ct_del_flow(struct nfp_fl_ct_map_entry *ct_map_ent) ...@@ -1141,20 +1141,7 @@ int nfp_fl_ct_del_flow(struct nfp_fl_ct_map_entry *ct_map_ent)
nfp_fl_ct_clean_flow_entry(ct_entry); nfp_fl_ct_clean_flow_entry(ct_entry);
kfree(ct_map_ent); kfree(ct_map_ent);
/* If this is the last pre_ct_rule it means that it is
* very likely that the nft table will be cleaned up next,
* as this happens on the removal of the last act_ct flow.
* However we cannot deregister the callback on the removal
* of the last nft flow as this runs into a deadlock situation.
* So deregister the callback on removal of the last pre_ct flow
* and remove any remaining nft flow entries. We also cannot
* save this state and delete the callback later since the
* nft table would already have been freed at that time.
*/
if (!zt->pre_ct_count) { if (!zt->pre_ct_count) {
nf_flow_table_offload_del_cb(zt->nft,
nfp_fl_ct_handle_nft_flow,
zt);
zt->nft = NULL; zt->nft = NULL;
nfp_fl_ct_clean_nft_entries(zt); nfp_fl_ct_clean_nft_entries(zt);
} }
......
...@@ -322,11 +322,22 @@ static int tcf_ct_flow_table_get(struct tcf_ct_params *params) ...@@ -322,11 +322,22 @@ static int tcf_ct_flow_table_get(struct tcf_ct_params *params)
static void tcf_ct_flow_table_cleanup_work(struct work_struct *work) static void tcf_ct_flow_table_cleanup_work(struct work_struct *work)
{ {
struct flow_block_cb *block_cb, *tmp_cb;
struct tcf_ct_flow_table *ct_ft; struct tcf_ct_flow_table *ct_ft;
struct flow_block *block;
ct_ft = container_of(to_rcu_work(work), struct tcf_ct_flow_table, ct_ft = container_of(to_rcu_work(work), struct tcf_ct_flow_table,
rwork); rwork);
nf_flow_table_free(&ct_ft->nf_ft); nf_flow_table_free(&ct_ft->nf_ft);
/* Remove any remaining callbacks before cleanup */
block = &ct_ft->nf_ft.flow_block;
down_write(&ct_ft->nf_ft.flow_block_lock);
list_for_each_entry_safe(block_cb, tmp_cb, &block->cb_list, list) {
list_del(&block_cb->list);
flow_block_cb_free(block_cb);
}
up_write(&ct_ft->nf_ft.flow_block_lock);
kfree(ct_ft); kfree(ct_ft);
module_put(THIS_MODULE); module_put(THIS_MODULE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment