summaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2024-02-01 23:33:29 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2024-02-07 22:02:51 +0100
commit292781c3c5485ce33bd22b2ef1b2bed709b4d672 (patch)
tree4dd03e51952b76aeb0e3caf77824e8f6030d6efe /net/netfilter
parent36fa8d697132b4bed2312d700310e8a78b000c84 (diff)
downloadlinux-292781c3c5485ce33bd22b2ef1b2bed709b4d672.tar.gz
linux-292781c3c5485ce33bd22b2ef1b2bed709b4d672.tar.bz2
linux-292781c3c5485ce33bd22b2ef1b2bed709b4d672.zip
netfilter: nft_compat: reject unused compat flag
Flag (1 << 0) is ignored is set, never used, reject it it with EINVAL instead. Fixes: 0ca743a55991 ("netfilter: nf_tables: add compatibility layer for x_tables") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nft_compat.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netfilter/nft_compat.c b/net/netfilter/nft_compat.c
index 001b6841a4b6..ed71d5ecbe0a 100644
--- a/net/netfilter/nft_compat.c
+++ b/net/netfilter/nft_compat.c
@@ -212,7 +212,8 @@ static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv)
return -EINVAL;
flags = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_FLAGS]));
- if (flags & ~NFT_RULE_COMPAT_F_MASK)
+ if (flags & NFT_RULE_COMPAT_F_UNUSED ||
+ flags & ~NFT_RULE_COMPAT_F_MASK)
return -EINVAL;
if (flags & NFT_RULE_COMPAT_F_INV)
*inv = true;