Skip to content

Commit

Permalink
Merge branch 'nfp-ct-fixes'
Browse files Browse the repository at this point in the history
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: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 2, 2021
2 parents a019abd + 7cc93d8 commit 99f47ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
13 changes: 0 additions & 13 deletions drivers/net/ethernet/netronome/nfp/flower/conntrack.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
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) {
nf_flow_table_offload_del_cb(zt->nft,
nfp_fl_ct_handle_nft_flow,
zt);
zt->nft = NULL;
nfp_fl_ct_clean_nft_entries(zt);
}
Expand Down
11 changes: 11 additions & 0 deletions net/sched/act_ct.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct flow_block_cb *block_cb, *tmp_cb;
struct tcf_ct_flow_table *ct_ft;
struct flow_block *block;

ct_ft = container_of(to_rcu_work(work), struct tcf_ct_flow_table,
rwork);
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);

module_put(THIS_MODULE);
Expand Down

0 comments on commit 99f47ea

Please sign in to comment.