summaryrefslogtreecommitdiffstats
path: root/net/netfilter
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2020-02-03 13:06:18 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2020-02-07 15:53:32 +0100
commita7da92c2c8a1faf253a3b3e292fda6910deba540 (patch)
treea897fe7b65546705dd6174b5d71aa49afb6e9971 /net/netfilter
parent8d0015a7ab76b8b1e89a3e5f5710a6e5103f2dd5 (diff)
downloadlinux-stable-a7da92c2c8a1faf253a3b3e292fda6910deba540.tar.gz
linux-stable-a7da92c2c8a1faf253a3b3e292fda6910deba540.tar.bz2
linux-stable-a7da92c2c8a1faf253a3b3e292fda6910deba540.zip
netfilter: flowtable: skip offload setup if disabled
nftables test case tests/shell/testcases/flowtable/0001flowtable_0 results in a crash. After the refactor, if we leave early via nf_flowtable_hw_offload(), then "struct flow_block_offload" is left in an uninitialized state, but later users assume its initialised. Fixes: a7965d58ddab02 ("netfilter: flowtable: add nf_flow_table_offload_cmd()") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net/netfilter')
-rw-r--r--net/netfilter/nf_flow_table_offload.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/netfilter/nf_flow_table_offload.c b/net/netfilter/nf_flow_table_offload.c
index 83e1db37c3b0..06f00cdc3891 100644
--- a/net/netfilter/nf_flow_table_offload.c
+++ b/net/netfilter/nf_flow_table_offload.c
@@ -847,9 +847,6 @@ static int nf_flow_table_offload_cmd(struct flow_block_offload *bo,
{
int err;
- if (!nf_flowtable_hw_offload(flowtable))
- return 0;
-
if (!dev->netdev_ops->ndo_setup_tc)
return -EOPNOTSUPP;
@@ -876,6 +873,9 @@ int nf_flow_table_offload_setup(struct nf_flowtable *flowtable,
struct flow_block_offload bo;
int err;
+ if (!nf_flowtable_hw_offload(flowtable))
+ return 0;
+
err = nf_flow_table_offload_cmd(&bo, flowtable, dev, cmd, &extack);
if (err < 0)
return err;