@@ -124,7 +124,7 @@ void flow_offload_free(struct flow_offload *flow)
dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_ORIGINAL].tuple.dst_cache);
dst_release(flow->tuplehash[FLOW_OFFLOAD_DIR_REPLY].tuple.dst_cache);
e = container_of(flow, struct flow_offload_entry, flow);
- kfree(e);
+ kfree_rcu(e, rcu_head);
}
EXPORT_SYMBOL_GPL(flow_offload_free);
@@ -161,7 +161,9 @@ void flow_offload_del(struct nf_flowtable *flow_table,
*flow_table->type->params);
e = container_of(flow, struct flow_offload_entry, flow);
- kfree_rcu(e, rcu_head);
+ nf_ct_delete(e->ct, 0, 0);
+ nf_ct_put(e->ct);
+ flow_offload_free(flow);
}
EXPORT_SYMBOL_GPL(flow_offload_del);
@@ -174,15 +176,6 @@ flow_offload_lookup(struct nf_flowtable *flow_table,
}
EXPORT_SYMBOL_GPL(flow_offload_lookup);
-static void nf_flow_release_ct(const struct flow_offload *flow)
-{
- struct flow_offload_entry *e;
-
- e = container_of(flow, struct flow_offload_entry, flow);
- nf_ct_delete(e->ct, 0, 0);
- nf_ct_put(e->ct);
-}
-
int nf_flow_table_iterate(struct nf_flowtable *flow_table,
void (*iter)(struct flow_offload *flow, void *data),
void *data)
@@ -276,10 +269,8 @@ void nf_flow_offload_work_gc(struct work_struct *work)
flow = container_of(tuplehash, struct flow_offload, tuplehash[0]);
if (nf_flow_has_expired(flow) ||
- nf_flow_is_dying(flow)) {
+ nf_flow_is_dying(flow))
flow_offload_del(flow_table, flow);
- nf_flow_release_ct(flow);
- }
}
out:
rhashtable_walk_stop(&hti);
When cleaning up flowtable entries, associated dst and ct entries need to be released as well Signed-off-by: Felix Fietkau <nbd@nbd.name> --- net/netfilter/nf_flow_table.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-)