netfilter: nft_tproxy: restrict to prerouting hook
PATCH 1/1 netfilter: nft_tproxy: restrict to prerouting hook
From: Florian Westphal <[email protected]>
commit 18bbc3213383a82b05383827f4b1b882e3f0a5a5 upstream.
TPROXY is only allowed from prerouting, but nft_tproxy doesn't check this. This fixes a crash (null dereference) when using tproxy from e.g. output.
Fixes 4ed8eb6570a4 ("netfilter: nf_tables: Add native tproxy support")
Reported-by Shell Chen <[email protected]>
Signed-off-by Florian Westphal <[email protected]>
Signed-off-by Qingfang DENG <[email protected]>
--- net/netfilter/nft_tproxy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/netfilter/nft_tproxy.c +8 -0
@@ -312,6 +312,13 @@ static int nft_tproxy_dump(struct sk_bufreturn 0 ; } +static int nft_tproxy_validate (const struct nft_ctx *ctx, +const struct nft_expr *expr, +const struct nft_data **data) +{ +return nft_chain_validate_hooks (ctx->chain,1 <<NF_INET_PRE_ROUTING ); +} +static struct nft_expr_type nft_tproxy_type;static const struct nft_expr_ops nft_tproxy_ops = { .type = &nft_tproxy_type,
@@ -320,6 +327,7 @@ static const struct nft_expr_ops nft_tpr .init = nft_tproxy_init, .destroy = nft_tproxy_destroy, .dump = nft_tproxy_dump, + .validate = nft_tproxy_validate, };static struct nft_expr_type nft_tproxy_type__read_mostly = {
Greg KH
maintainerQuoted 7 lines · Qingfang DENG
From: Florian Westphal <[email protected]>
commit
18bbc3213383a82b05383827f4b1b882e3f0a5a5upstream.TPROXY is only allowed from prerouting, but
nft_tproxydoesn't check this. This fixes a crash (null dereference) when using tproxy from e.g. output.
Quoted 7 lines
Fixes 4ed8eb6570a4 ("netfilter: nf_tables: Add native tproxy support")Reported-by Shell Chen <[email protected]>Signed-off-by Florian Westphal <[email protected]>Signed-off-by Qingfang DENG <[email protected]>--- net/netfilter/nft_tproxy.c | 8 ++++++++ 1 file changed, 8 insertions(+)
Now queued up, thanks.
greg k-h