net/mlx5: fix the profile check of meter mark
PATCH 1/1 net/mlx5: fix the profile check of meter mark
When creating a meter_mark action, the profile should be specified. Or else there would be a crash if the pointer to the profile was not set properly:
1. creating an action template with only action mask set and using this template to create a table
2. creating a flow rule without setting the profile if the action of meter_mark is not fixed
The check should be done inside the action allocation and an error needs to be returned immediately.
--- drivers/net/mlx5/mlx5_flow_hw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/mlx5/mlx5_flow_hw.c +2 -0
@@ -1325,6 +1325,8 @@ flow_hw_meter_mark_alloc(struct rte_eth_dev *dev, uint32_t queue,struct mlx5_flow_meter_info *fm;uint32_t mtr_id; +if (meter_mark->profile ==NULL ) +return NULL ; aso_mtr =mlx5_ipool_malloc (priv->hws_mpool->idx_pool, &mtr_id);if (!aso_mtr)return NULL ;
Signature · 1 line
2.34.1
Hi,
Quoted 21 lines
-----Original Message-----
From: Bing Zhao <[email protected]>
Sent: Friday, June 30, 2023 3:45 PM
To: Matan Azrad <[email protected]>; Slava Ovsiienko <[email protected]>; Ori Kam <[email protected]>; Suanming Mou <[email protected]>; Raslan Darawsheh <[email protected]>
Cc: [email protected]; Alexander Kozyrev <[email protected]>; [email protected]
Subject: [PATCH] net/mlx5: fix the profile check of meter markWhen creating a
meter_markaction, the profile should be specified. Or else there would be a crash if the pointer to the profile was not set properly:
1. creating an action template with only action mask set and using this template to create a table
2. creating a flow rule without setting the profile if the action ofmeter_markis not fixedThe check should be done inside the action allocation and an error needs to be returned immediately.
Quoted 7 lines
Fixes 48fbb0e93d06 ("net/mlx5: support flow meter mark indirect actionwith HWS")
Cc: [email protected]
Cc: [email protected]Signed-off-by Bing Zhao <[email protected]>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh