FAILED: patch "[PATCH] netfilter: nf_tables: disallow jump to implicit chain from" failed to apply to 5.18-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f323ef3a0d49e147365284bc1f02212e617b7f09 Mon Sep 17 00:00:00 2001
From: Pablo Neira Ayuso <[email protected]>
Date: Mon, 8 Aug 2022 19:30:07 +0200
Subject: [PATCH] netfilter: nf_tables: disallow jump to implicit chain from
set element
Extend struct nft_data_desc to add a flag field that specifies nft_data_init() is being called for set element data.
Use it to disallow jump to implicit chain from set element, only jump to chain via immediate expression is allowed.
include/net/netfilter/nf_tables.h +5 -0
@@ -221,10 +221,15 @@ struct nft_ctx {bool report; }; +enum nft_data_desc_flags { +NFT_DATA_DESC_SETELEM = (1 <<0 ), +}; +struct nft_data_desc {enum nft_data_types type;unsigned int size;unsigned int len; +unsigned int flags; }; int nft_data_init(const struct nft_ctx *ctx, struct nft_data *data,
net/netfilter/nf_tables_api.c +4 -0
@@ -5226,6 +5226,7 @@ static int nft_setelem_parse_data(struct nft_ctx *ctx, struct nft_set *set, desc->type = dtype; desc->size =NFT_DATA_VALUE_MAXLEN ; desc->len = set->dlen; + desc->flags =NFT_DATA_DESC_SETELEM ;return nft_data_init (ctx, data, desc, attr); }
@@ -9665,6 +9666,9 @@ static int nft_verdict_init(const struct nft_ctx *ctx, struct nft_data *data,return PTR_ERR (chain);if (nft_is_base_chain (chain))return -EOPNOTSUPP ; +if (desc->flags &NFT_DATA_DESC_SETELEM && + chain->flags &NFT_CHAIN_BINDING ) +return -EINVAL ; chain->use++; data->verdict.chain = chain;