summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2021-02-27 22:31:27 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2021-03-02 16:37:22 +0100
commit9cc0001a18b4e5f46ec481201c88ae16f0a69bb0 (patch)
treeeed207ebcc8cd4f942869d48a0f2f947f89243e2
parentnetfilter: x_tables: gpf inside xt_find_revision() (diff)
downloadlinux-9cc0001a18b4e5f46ec481201c88ae16f0a69bb0.tar.xz
linux-9cc0001a18b4e5f46ec481201c88ae16f0a69bb0.zip
netfilter: nftables: disallow updates on table ownership
Disallow updating the ownership bit on an existing table: Do not allow to grab ownership on an existing table. Do not allow to drop ownership on an existing table. Fixes: 6001a930ce03 ("netfilter: nftables: introduce table ownership") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r--net/netfilter/nf_tables_api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c
index c1eb5cdb3033..b07703e19108 100644
--- a/net/netfilter/nf_tables_api.c
+++ b/net/netfilter/nf_tables_api.c
@@ -916,6 +916,12 @@ static int nf_tables_updtable(struct nft_ctx *ctx)
if (flags == ctx->table->flags)
return 0;
+ if ((nft_table_has_owner(ctx->table) &&
+ !(flags & NFT_TABLE_F_OWNER)) ||
+ (!nft_table_has_owner(ctx->table) &&
+ flags & NFT_TABLE_F_OWNER))
+ return -EOPNOTSUPP;
+
trans = nft_trans_alloc(ctx, NFT_MSG_NEWTABLE,
sizeof(struct nft_trans_table));
if (trans == NULL)