Skip to content

Commit d17406d

Browse files
committed
netfilter: nf_tables: tighten netlink attribute requirements for catch-all elements
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550 Upstream Status: commit d4eb7e3 commit d4eb7e3 Author: Pablo Neira Ayuso <[email protected]> Date: Mon Apr 17 17:50:28 2023 +0200 netfilter: nf_tables: tighten netlink attribute requirements for catch-all elements If NFT_SET_ELEM_CATCHALL is set on, then userspace provides no set element key. Otherwise, bail out with -EINVAL. Fixes: aaa3104 ("netfilter: nftables: add catch-all set element support") Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Florian Westphal <[email protected]>
1 parent 39bf804 commit d17406d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5921,7 +5921,8 @@ static int nft_add_set_elem(struct nft_ctx *ctx, struct nft_set *set,
59215921
if (err < 0)
59225922
return err;
59235923

5924-
if (!nla[NFTA_SET_ELEM_KEY] && !(flags & NFT_SET_ELEM_CATCHALL))
5924+
if (((flags & NFT_SET_ELEM_CATCHALL) && nla[NFTA_SET_ELEM_KEY]) ||
5925+
(!(flags & NFT_SET_ELEM_CATCHALL) && !nla[NFTA_SET_ELEM_KEY]))
59255926
return -EINVAL;
59265927

59275928
if (flags != 0) {

0 commit comments

Comments
 (0)