]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: disallow element removal on anonymous sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Sun, 10 Sep 2023 17:04:45 +0000 (19:04 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Oct 2023 12:56:35 +0000 (14:56 +0200)
commit1e01b127685fcdd6041ef087776b88094acc2f3d
tree1e6d85092d2a62297a49314349099477316a82f5
parent7a7fd891022a692ecfa1e32b6eb3de417669afd2
netfilter: nf_tables: disallow element removal on anonymous sets

[ Upstream commit 23a3bfd4ba7acd36abf52b78605f61b21bdac216 ]

Anonymous sets need to be populated once at creation and then they are
bound to rule since 938154b93be8 ("netfilter: nf_tables: reject unbound
anonymous set before commit phase"), otherwise transaction reports
EINVAL.

Userspace does not need to delete elements of anonymous sets that are
not yet bound, reject this with EOPNOTSUPP.

From flush command path, skip anonymous sets, they are expected to be
bound already. Otherwise, EINVAL is hit at the end of this transaction
for unbound sets.

Fixes: 96518518cc41 ("netfilter: add nftables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c