net/i40e: populate error in flow director parser
authorMike Pattrick <mkp@redhat.com>
Tue, 22 Mar 2022 03:19:37 +0000 (23:19 -0400)
committerQi Zhang <qi.z.zhang@intel.com>
Mon, 18 Apr 2022 05:47:18 +0000 (07:47 +0200)
Errors from i40e_flow_parse_fdir_pattern() can bubble up to
rte_flow_create. If rte_flow_error is not initialized a caller may
dereference error->message. This may be uninitialized memory, leading
to a segemntation fault.

Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Cc: stable@dpdk.org
Signed-off-by: Mike Pattrick <mkp@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
drivers/net/i40e/i40e_flow.c

index e0cf996..4f3808c 100644 (file)
@@ -3142,8 +3142,11 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
                /* Check if the input set is valid */
                if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
                                                input_set) != 0) {
-                       PMD_DRV_LOG(ERR, "Invalid input set");
-                       return -EINVAL;
+                       rte_flow_error_set(error, EINVAL,
+                                          RTE_FLOW_ERROR_TYPE_ITEM,
+                                          item,
+                                          "Invalid input set");
+                       return -rte_errno;
                }
 
                filter->input.flow_ext.input_set = input_set;