net/sfc: add explicit fail path for unknown tunnel flow type
PATCH 1/1 net/sfc: add explicit fail path for unknown tunnel flow type
The driver supports flow tunnel offload. When the parsed rule type is unknown, which must not happen, the driver does not properly indicate the failure in non-debug builds. That presumably makes Coverity report possible NULL pointer dereference in regard with uninitialised HW match specification (which gets properly initialised
when the rule type check is successful).
In order to fix this, replace the debug
assert with a proper runtime fail path.
Coverity issue: 393675
--- drivers/net/sfc/sfc_mae.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/sfc/sfc_mae.c +5 -2
@@ -3460,8 +3460,10 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa, }break ;default : -SFC_ASSERT (B_FALSE ); -break ; + rc =rte_flow_error_set (error,EINVAL , +RTE_FLOW_ERROR_TYPE_UNSPECIFIED ,NULL , +"FT: unexpected rule type" ); + goto fail_unexpected_ft_rule_type; }/*
@@ -3531,6 +3533,7 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa,if (ctx_mae.match_spec_action !=NULL )efx_mae_match_spec_fini (sa->nic, ctx_mae.match_spec_action); +fail_unexpected_ft_rule_type: fail_init_match_spec_action: fail_priority_check:return rc;
Signature · 1 line
2.17.1
Quoted 8 lines · Ivan Malov
The driver supports flow tunnel offload. When the parsed rule type is unknown, which must not happen, the driver does not properly indicate the failure in non-debug builds. That presumably makes Coverity report possible NULL pointer dereference in regard with uninitialised HW match specification (which gets properly initialised
when the rule type check is successful).
Quoted 8 lines
In order to fix this, replace the debug
assert with a proper runtime fail path.Coverity issue: 393675
Fixes 73e01736868b ("net/sfc: turn MAE flow action rules into shareable resources")Signed-off-by Ivan Malov <[email protected]>
Ferruh Yigit
AppliedQuoted 12 lines · Andrew Rybchenko
Quoted 11 lines · Ivan Malov
The driver supports flow tunnel offload. When the parsed rule type is unknown, which must not happen, the driver does not properly indicate the failure in non-debug builds. That presumably makes Coverity report possible NULL pointer dereference in regard with uninitialised HW match specification (which gets properly initialised
when the rule type check is successful).In order to fix this, replace the debug
assert with a proper runtime fail path.
Quoted 9 lines
Quoted 6 lines
Coverity issue: 393675
Fixes 73e01736868b ("net/sfc: turn MAE flow action rules intoshareable resources")
Cc: [email protected]Signed-off-by Ivan Malov <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
Applied to dpdk-next-net/main, thanks.