netfilter: nf_tables: fix memory leaks on chain rename
authorFlorian Westphal <fw@strlen.de>
Tue, 17 Jul 2018 05:17:55 +0000 (07:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 20 Jul 2018 13:31:43 +0000 (15:31 +0200)
commit9f8aac0be21ed5f99bd5ba0ff315d710737d1794
treed0aa94d3846720a7bfe8bbc396529a21a120da90
parenta12486ebe104190a6c10557134014290afa98370
netfilter: nf_tables: fix memory leaks on chain rename

The new name is stored in the transaction metadata, on commit,
the pointers to the old and new names are swapped.

Therefore in abort and commit case we have to free the
pointer in the chain_trans container.

In commit case, the pointer can be used by another cpu that
is currently dumping the renamed chain, thus kfree needs to
happen after waiting for rcu readers to complete.

Fixes: b7263e071a ("netfilter: nf_tables: Allow chain name of up to 255 chars")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c