netfilter: nf_tables: fix flowtable free
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Feb 2018 12:22:47 +0000 (13:22 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 6 Feb 2018 23:58:57 +0000 (00:58 +0100)
commitb408c5b04f82fe4e20bceb8e4f219453d4f21f02
treecd33d1bcfebc1bc0bdddef0379b57eb28ef20131
parentc0ea1bcb39352b57ac5c4b6da8acd65bddeee2c5
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>
include/net/netfilter/nf_flow_table.h
net/ipv4/netfilter/nf_flow_table_ipv4.c
net/ipv6/netfilter/nf_flow_table_ipv6.c
net/netfilter/nf_flow_table.c
net/netfilter/nf_flow_table_inet.c
net/netfilter/nf_tables_api.c