]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nf_tables: mark newset as dead on transaction abort
authorFlorian Westphal <fw@strlen.de>
Mon, 27 Nov 2023 10:00:37 +0000 (11:00 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 22 Dec 2023 11:08:38 +0000 (12:08 +0100)
commit08e4c8c5919fd405a4d709b4ba43d836894a26eb
tree03f0026c4e1e90825b5b3fab3090ad3b053a0a6b
parent3fde94b6e930f5a0fd4f6458da8d559c898f2322
netfilter: nf_tables: mark newset as dead on transaction abort

If a transaction is aborted, we should mark the to-be-released NEWSET dead,
just like commit path does for DEL and DESTROYSET commands.

In both cases all remaining elements will be released via
set->ops->destroy().

The existing abort code does NOT post the actual release to the work queue.
Also the entire __nf_tables_abort() function is wrapped in gc_seq
begin/end pair.

Therefore, async gc worker will never try to release the pending set
elements, as gc sequence is always stale.

It might be possible to speed up transaction aborts via work queue too,
this would result in a race and a possible use-after-free.

So fix this before it becomes an issue.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/nf_tables_api.c