]> 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)
commit3d13facecf22a37f13fb6b9c671645fd840aef87
treed0aa94d3846720a7bfe8bbc396529a21a120da90
parentc2d39c1a4ab481bebe0c66b7002d91ebbcd91c83
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: 3a7565d6a1 ("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