]> git.baikalelectronics.ru Git - kernel.git/commit
netfilter: nf_tables: perform type checking for existing sets
authorPablo Neira Ayuso <pablo@netfilter.org>
Mon, 19 Dec 2022 19:09:00 +0000 (20:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2023 11:01:57 +0000 (12:01 +0100)
commitb03a6f2ebfc78ea4d4c48a5f0e5eeb70f20ab060
treeca187ee6b34abe6a86dfcaea81a6ceeb892137fe
parent825e50affb5d31bceeacbb41ed46e43145f7235e
netfilter: nf_tables: perform type checking for existing sets

[ Upstream commit f6594c372afd5cec8b1e9ee9ea8f8819d59c6fb1 ]

If a ruleset declares a set name that matches an existing set in the
kernel, then validate that this declaration really refers to the same
set, otherwise bail out with EEXIST.

Currently, the kernel reports success when adding a set that already
exists in the kernel. This usually results in EINVAL errors at a later
stage, when the user adds elements to the set, if the set declaration
mismatches the existing set representation in the kernel.

Add a new function to check that the set declaration really refers to
the same existing set in the kernel.

Fixes: 4a4835e91e03 ("netfilter: add nftables")
Reported-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/nf_tables_api.c