netfilter: nf_tables: warn when expr implements only one of activate/deactivate
authorFlorian Westphal <fw@strlen.de>
Thu, 30 Aug 2018 08:42:55 +0000 (10:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2019 07:58:50 +0000 (09:58 +0200)
commit27458b5457d3d99974c60387f57d5a8aed3a597d
tree4e162cfc9df602ebcae35ece2c46d008f9cfde46
parentcb2e343d1d85df3cc9947fd8ce478ebda4a2f546
netfilter: nf_tables: warn when expr implements only one of activate/deactivate

->destroy is only allowed to free data, or do other cleanups that do not
have side effects on other state, such as visibility to other netlink
requests.

Such things need to be done in ->deactivate.
As a transaction can fail, we need to make sure we can undo such
operations, therefore ->activate() has to be provided too.

So print a warning and refuse registration if expr->ops provides
only one of the two operations.

v2: fix nft_expr_check_ops to not repeat same check twice (Jones Desougi)

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c