Skip to content

Commit c1f79a2

Browse files
committed
netfilter: nf_tables: reject unsupported chain flags
Bail out if userspace sends unsupported chain flags. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent d0e2c7d commit c1f79a2

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

‎include/uapi/linux/netfilter/nf_tables.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ enum nft_chain_flags {
189189
NFT_CHAIN_HW_OFFLOAD = (1 << 1),
190190
NFT_CHAIN_BINDING = (1 << 2),
191191
};
192+
#define NFT_CHAIN_FLAGS (NFT_CHAIN_BASE | \
193+
NFT_CHAIN_HW_OFFLOAD | \
194+
NFT_CHAIN_BINDING)
192195

193196
/**
194197
* enum nft_chain_attributes - nf_tables chain netlink attributes

‎net/netfilter/nf_tables_api.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2285,6 +2285,9 @@ static int nf_tables_newchain(struct net *net, struct sock *nlsk,
22852285
else if (chain)
22862286
flags = chain->flags;
22872287

2288+
if (flags & ~NFT_CHAIN_FLAGS)
2289+
return -EOPNOTSUPP;
2290+
22882291
nft_ctx_init(&ctx, net, skb, nlh, family, table, chain, nla);
22892292

22902293
if (chain != NULL) {

0 commit comments

Comments
 (0)