Skip to content

Commit a7da92c

Browse files
Florian Westphalummakynes
authored andcommitted
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: a7965d5 ("netfilter: flowtable: add nf_flow_table_offload_cmd()") Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 8d0015a commit a7da92c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/netfilter/nf_flow_table_offload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,9 +847,6 @@ static int nf_flow_table_offload_cmd(struct flow_block_offload *bo,
847847
{
848848
int err;
849849

850-
if (!nf_flowtable_hw_offload(flowtable))
851-
return 0;
852-
853850
if (!dev->netdev_ops->ndo_setup_tc)
854851
return -EOPNOTSUPP;
855852

@@ -876,6 +873,9 @@ int nf_flow_table_offload_setup(struct nf_flowtable *flowtable,
876873
struct flow_block_offload bo;
877874
int err;
878875

876+
if (!nf_flowtable_hw_offload(flowtable))
877+
return 0;
878+
879879
err = nf_flow_table_offload_cmd(&bo, flowtable, dev, cmd, &extack);
880880
if (err < 0)
881881
return err;

0 commit comments

Comments
 (0)