]> 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)
commit815fac68e781c309c723a8a5820b9455b357f2b3
tree89aa5dc4df79d38b67a479ace62e396d3b78dd11
parentb0f6d0b79c7ebad9fe8aff0d824cd4ec1e83942d
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 dbd421d01b01 ("netfilter: core: free
hooks with call_rcu").

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