netfilter: nft_compat: reject unused compat flag
[ Upstream commit 292781c3c5485ce33bd22b2ef1b2bed709b4d672 ]
Flag (1 << 0) is ignored is set, never used, reject it it with EINVAL
instead.
Fixes: 0ca743a559
("netfilter: nf_tables: add compatibility layer for x_tables")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
b06e067e93
commit
78909916a2
@@ -262,9 +262,11 @@ enum nft_rule_attributes {
|
|||||||
/**
|
/**
|
||||||
* enum nft_rule_compat_flags - nf_tables rule compat flags
|
* enum nft_rule_compat_flags - nf_tables rule compat flags
|
||||||
*
|
*
|
||||||
|
* @NFT_RULE_COMPAT_F_UNUSED: unused
|
||||||
* @NFT_RULE_COMPAT_F_INV: invert the check result
|
* @NFT_RULE_COMPAT_F_INV: invert the check result
|
||||||
*/
|
*/
|
||||||
enum nft_rule_compat_flags {
|
enum nft_rule_compat_flags {
|
||||||
|
NFT_RULE_COMPAT_F_UNUSED = (1 << 0),
|
||||||
NFT_RULE_COMPAT_F_INV = (1 << 1),
|
NFT_RULE_COMPAT_F_INV = (1 << 1),
|
||||||
NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
|
NFT_RULE_COMPAT_F_MASK = NFT_RULE_COMPAT_F_INV,
|
||||||
};
|
};
|
||||||
|
@@ -204,7 +204,8 @@ static int nft_parse_compat(const struct nlattr *attr, u16 *proto, bool *inv)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
flags = ntohl(nla_get_be32(tb[NFTA_RULE_COMPAT_FLAGS]));
|
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;
|
return -EINVAL;
|
||||||
if (flags & NFT_RULE_COMPAT_F_INV)
|
if (flags & NFT_RULE_COMPAT_F_INV)
|
||||||
*inv = true;
|
*inv = true;
|
||||||
|
Reference in New Issue
Block a user