summaryrefslogtreecommitdiff
path: root/net/ipv4/netfilter/nf_flow_table_ipv4.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2018-02-06 13:22:47 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2018-02-07 00:58:57 +0100
commitb408c5b04f82fe4e20bceb8e4f219453d4f21f02 (patch)
treecd33d1bcfebc1bc0bdddef0379b57eb28ef20131 /net/ipv4/netfilter/nf_flow_table_ipv4.c
parentc0ea1bcb39352b57ac5c4b6da8acd65bddeee2c5 (diff)
netfilter: nf_tables: fix flowtable free
Every flow_offload entry is added into the table twice. Because of this, rhashtable_free_and_destroy can't be used, since it would call kfree for each flow_offload object twice. This patch cleans up the flowtable via nf_flow_table_iterate() to schedule removal of entries by setting on the dying bit, then there is an explicitly invocation of the garbage collector to release resources. Based on patch from Felix Fietkau. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/ipv4/netfilter/nf_flow_table_ipv4.c')
-rw-r--r--net/ipv4/netfilter/nf_flow_table_ipv4.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/nf_flow_table_ipv4.c b/net/ipv4/netfilter/nf_flow_table_ipv4.c
index b2d01eb25f2c..25d2975da156 100644
--- a/net/ipv4/netfilter/nf_flow_table_ipv4.c
+++ b/net/ipv4/netfilter/nf_flow_table_ipv4.c
@@ -260,6 +260,7 @@ static struct nf_flowtable_type flowtable_ipv4 = {
.family = NFPROTO_IPV4,
.params = &nf_flow_offload_rhash_params,
.gc = nf_flow_offload_work_gc,
+ .free = nf_flow_table_free,
.hook = nf_flow_offload_ip_hook,
.owner = THIS_MODULE,
};