From 05e8b05d08d9f764990217c44dc72c2b6e2c5867 Mon Sep 17 00:00:00 2001 From: Ivan Malov Date: Tue, 20 Oct 2020 10:12:51 +0100 Subject: [PATCH] net/sfc: validate match spec in MAE backend Validate the match specification resulting from pattern parsing within MAE backend in RTE flow implementation. Signed-off-by: Ivan Malov Signed-off-by: Andrew Rybchenko Reviewed-by: Andy Moreton --- drivers/net/sfc/sfc_mae.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/sfc/sfc_mae.c b/drivers/net/sfc/sfc_mae.c index 53e141775a..7e4397762b 100644 --- a/drivers/net/sfc/sfc_mae.c +++ b/drivers/net/sfc/sfc_mae.c @@ -130,10 +130,18 @@ sfc_mae_rule_parse_pattern(struct sfc_adapter *sa, if (rc != 0) goto fail_parse_pattern; + if (!efx_mae_match_spec_is_valid(sa->nic, ctx_mae.match_spec_action)) { + rc = rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, NULL, + "Inconsistent pattern"); + goto fail_validate_match_spec_action; + } + spec->match_spec = ctx_mae.match_spec_action; return 0; +fail_validate_match_spec_action: fail_parse_pattern: efx_mae_match_spec_fini(sa->nic, ctx_mae.match_spec_action); -- 2.20.1