netfilter: nf_tables: release objects on netns destruction

We have to release the existing objects on netns removal otherwise we
leak them. Chains are unregistered in first place to make sure no
packets are walking on our rules and sets anymore.

The object release happens by when we unregister the family via
nft_release_afinfo() which is called from nft_unregister_afinfo() from
the corresponding __net_exit path in every family.

Reported-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
This commit is contained in:
Pablo Neira Ayuso
2015-12-15 19:39:32 +01:00
parent 26a4d063b1
commit df05ef874b
8 changed files with 52 additions and 9 deletions

View File

@@ -77,7 +77,7 @@ err:
static void nf_tables_ipv6_exit_net(struct net *net)
{
nft_unregister_afinfo(net->nft.ipv6);
nft_unregister_afinfo(net, net->nft.ipv6);
kfree(net->nft.ipv6);
}