OSDN Git Service

netfilter: nf_tables: add nft_set_elem_expr_destroy() and use it
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 18 Mar 2020 13:29:45 +0000 (14:29 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Thu, 19 Mar 2020 10:37:32 +0000 (11:37 +0100)
commit475beb9c8de1227ff6ec572f37a05c5c612d94a7
tree0f9045ad1d21208b0c1915d5bd88828fe3e2be3a
parent772f4e82b3ffa1eb7412cd531f718a96a0e5474b
netfilter: nf_tables: add nft_set_elem_expr_destroy() and use it

This patch adds nft_set_elem_expr_destroy() to destroy stateful
expressions in set elements.

This patch also updates the commit path to call this function to invoke
expr->ops->destroy_clone when required.

This is implicitly fixing up a module reference counter leak and
a memory leak in expressions that allocated internal state, e.g.
nft_counter.

Fixes: 409444522976 ("netfilter: nf_tables: add elements with stateful expressions")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c