mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
netfilter: nf_tables: disallow element updates of bound anonymous sets
[ Upstream commitc88c535b59] Anonymous sets come with NFT_SET_CONSTANT from userspace. Although API allows to create anonymous sets without NFT_SET_CONSTANT, it makes no sense to allow to add and to delete elements for bound anonymous 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
0d836f9175
commit
b60c0ce0ff
@@ -6590,7 +6590,8 @@ static int nf_tables_newsetelem(struct sk_buff *skb,
|
|||||||
if (IS_ERR(set))
|
if (IS_ERR(set))
|
||||||
return PTR_ERR(set);
|
return PTR_ERR(set);
|
||||||
|
|
||||||
if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT)
|
if (!list_empty(&set->bindings) &&
|
||||||
|
(set->flags & (NFT_SET_CONSTANT | NFT_SET_ANONYMOUS)))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
|
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
|
||||||
@@ -6864,7 +6865,9 @@ static int nf_tables_delsetelem(struct sk_buff *skb,
|
|||||||
set = nft_set_lookup(table, nla[NFTA_SET_ELEM_LIST_SET], genmask);
|
set = nft_set_lookup(table, nla[NFTA_SET_ELEM_LIST_SET], genmask);
|
||||||
if (IS_ERR(set))
|
if (IS_ERR(set))
|
||||||
return PTR_ERR(set);
|
return PTR_ERR(set);
|
||||||
if (!list_empty(&set->bindings) && set->flags & NFT_SET_CONSTANT)
|
|
||||||
|
if (!list_empty(&set->bindings) &&
|
||||||
|
(set->flags & (NFT_SET_CONSTANT | NFT_SET_ANONYMOUS)))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
|
nft_ctx_init(&ctx, net, skb, info->nlh, family, table, NULL, nla);
|
||||||
|
|||||||
Reference in New Issue
Block a user