]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nftables: fix possible UAF over chains from packet path in netns
authorPablo Neira Ayuso <pablo@netfilter.org>
Tue, 2 Feb 2021 15:07:37 +0000 (16:07 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 3 Feb 2021 23:33:09 +0000 (00:33 +0100)
commit1a05a5a417511a1909ecaa4868a4245001fd389d
tree89aa5dc4df79d38b67a479ace62e396d3b78dd11
parent58e1c71f2fc12984c2feb73edad60edb05b21308
netfilter: nftables: fix possible UAF over chains from packet path in netns

Although hooks are released via call_rcu(), chain and rule objects are
immediately released while packets are still walking over these bits.

This patch adds the .pre_exit callback which is invoked before
synchronize_rcu() in the netns framework to stay safe.

Remove a comment which is not valid anymore since the core does not use
synchronize_net() anymore since 245e3dd749c7 ("netfilter: core: free
hooks with call_rcu").

Suggested-by: Florian Westphal <fw@strlen.de>
Fixes: 68e65eb54096 ("netfilter: nf_tables: release objects on netns destruction")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c