]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitc3545f2c11d377a4ce8205162aa3ca1a411b6a95
treed0aa94d3846720a7bfe8bbc396529a21a120da90
parent59e8e03be457f0cf1ae4f6d367a3d1cab8c7323f
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: fb1e5cd6e4 ("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