]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: nf_tables: validate all pending tables
authorFlorian Westphal <fw@strlen.de>
Thu, 17 Aug 2023 18:28:32 +0000 (20:28 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 12:52:33 +0000 (14:52 +0200)
commite290509f8be5cb50cb9ccddc11c28db6016ce25e
tree84bdd784183e9d7d951f48a5a5313a478c847a60
parent711ffb6fa5a0a69a5c007e7b683c8aaa9b1cb6de
netfilter: nf_tables: validate all pending tables

[ Upstream commit 4b80ced971b0d118f9a11dd503a5833a5016de92 ]

We have to validate all tables in the transaction that are in
VALIDATE_DO state, the blamed commit below did not move the break
statement to its right location so we only validate one table.

Moreover, we can't init table->validate to _SKIP when a table object
is allocated.

If we do, then if a transcaction creates a new table and then
fails the transaction, nfnetlink will loop and nft will hang until
user cancels the command.

Add back the pernet state as a place to stash the last state encountered.
This is either _DO (we hit an error during commit validation) or _SKIP
(transaction passed all checks).

Fixes: 00c320f9b755 ("netfilter: nf_tables: make validation state per table")
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c