Skip to contentSkip to conversation

net/i40e: Populate error in flow_parse_fdir_pattern

PATCH Applied Mike Pattrick 3 participants 3 messages Mar 22, 2022 – Mar 24, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/i40e: Populate error in flow_parse_fdir_pattern

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")
---
 drivers/net/i40e/i40e_flow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_flow.c +5 -2
index e0cf996200..4f3808cb5f 100644
@@ -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;
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw

Hello Mike,

Quoted 9 lines · Mike Pattrick

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")

Nit: the convention in DPDK is to have a block with the Fixes: and Cc:
lines together first, then the rest of the tags in a second block.

Fixes 4a072ad43442 ("net/i40e: fix flow director config after flow validate")

<empty line>

Quoted 23 lines
---
 drivers/net/i40e/i40e_flow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/i40e/i40e_flow.c +5 -3
index e0cf996200..4f3808cb5f 100644
@@ -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;
--
Quoted 2 lines

2.27.0

Signature · 1 line
David Marchand
Applied
#2 lore raw
Quoted 10 lines

-----Original Message-----
From: David Marchand <[email protected]>
Sent: Tuesday, March 22, 2022 4:36 PM
To: Mike Pattrick <[email protected]>
Cc: Xing, Beilei <[email protected]>; [email protected]; dev <[email protected]>; dpdk stable <[email protected]>
Subject: Re: [PATCH] net/i40e: Populate error in flow_parse_fdir_pattern

Renamed title to

"net/i40e: populate error in FDIR flow pattern parser"

To fix check-git-log warning

Quoted 45 lines

Hello Mike,

Quoted 10 lines · Mike Pattrick

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: [email protected]

Nit: the convention in DPDK is to have a block with the Fixes: and Cc:
lines together first, then the rest of the tags in a second block.

Fixes 4a072ad43442 ("net/i40e: fix flow director config after flow validate")

<empty line>

drivers/net/i40e/i40e_flow.c i40e_flow_parse_fdir_pattern(struct

Quoted 9 lines
---
 drivers/net/i40e/i40e_flow.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_flow.c index e0cf996200..4f3808cb5f 100644

drivers/net/i40e/i40e_flow.c +0 -0
@@ -3142,8 +3142,11 @@ i40e_flow_parse_fdir_pattern(struct

rte_eth_dev *dev,

Quoted 12 lines
drivers/net/i40e/i40e_flow.c +5 -2
                /* 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;
                }
 
Quoted 6 lines
Quoted 4 lines
drivers/net/i40e/i40e_flow.c +0 -1
                filter->input.flow_ext.input_set = input_set;
--

2.27.0

Applied to dpdk-next-net-intel.

Thanks
Qi

Quoted 4 lines

--
David Marchand