mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-24 19:40:21 +09:00
netfilter: nf_tables: disallow element removal on anonymous sets
[ Upstream commit23a3bfd4ba] Anonymous sets need to be populated once at creation and then they are bound to rule since938154b93b("netfilter: nf_tables: reject unbound anonymous set before commit phase"), otherwise transaction reports EINVAL. Userspace does not need to delete elements of anonymous sets that are not yet bound, reject this with EOPNOTSUPP. From flush command path, skip anonymous sets, they are expected to be bound already. Otherwise, EINVAL is hit at the end of this transaction for unbound sets. Fixes:96518518cc("netfilter: add nftables") 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
7a7fd89102
commit
1e01b12768
@@ -1437,8 +1437,7 @@ static int nft_flush_table(struct nft_ctx *ctx)
|
||||
if (!nft_is_active_next(ctx->net, set))
|
||||
continue;
|
||||
|
||||
if (nft_set_is_anonymous(set) &&
|
||||
!list_empty(&set->bindings))
|
||||
if (nft_set_is_anonymous(set))
|
||||
continue;
|
||||
|
||||
err = nft_delset(ctx, set);
|
||||
@@ -6907,8 +6906,10 @@ static int nf_tables_delsetelem(struct sk_buff *skb,
|
||||
if (IS_ERR(set))
|
||||
return PTR_ERR(set);
|
||||
|
||||
if (!list_empty(&set->bindings) &&
|
||||
(set->flags & (NFT_SET_CONSTANT | NFT_SET_ANONYMOUS)))
|
||||
if (nft_set_is_anonymous(set))
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
if (!list_empty(&set->bindings) && (set->flags & NFT_SET_CONSTANT))
|
||||
return -EBUSY;
|
||||
|
||||
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
|
||||
|
||||
Reference in New Issue
Block a user