net/sfc: validate match spec in MAE backend
authorIvan Malov <ivan.malov@oktetlabs.ru>
Tue, 20 Oct 2020 09:12:51 +0000 (10:12 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 3 Nov 2020 22:24:24 +0000 (23:24 +0100)
Validate the match specification resulting from pattern
parsing within MAE backend in RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
drivers/net/sfc/sfc_mae.c

index 53e1417..7e43977 100644 (file)
@@ -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);