DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action conf is NULL
@ 2019-12-13 14:21 xiangxia.m.yue
  2019-12-16  1:29 ` Tonghao Zhang
  0 siblings, 1 reply; 8+ messages in thread
From: xiangxia.m.yue @ 2019-12-13 14:21 UTC (permalink / raw)
  To: matan, shahafs; +Cc: dev, Tonghao Zhang, Suanming Mou

From: Tonghao Zhang <xiangxia.m.yue@gmail.com>

When offloading the meter, should check the action
conf and make sure it is valid.

Fixes: f46bf7488705 ("net/mlx5: support meter flow action")
Cc: Suanming Mou <suanmingm@mellanox.com>

Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
---
v2: coding style issues: http://patches.dpdk.org/patch/63849/
---
 drivers/net/mlx5/mlx5_flow_dv.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 73aaea4..7528556 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -3402,7 +3402,12 @@ struct field_modify_info modify_tcp[] = {
 {
 	struct mlx5_priv *priv = dev->data->dev_private;
 	const struct rte_flow_action_meter *am = action->conf;
-	struct mlx5_flow_meter *fm = mlx5_flow_meter_find(priv, am->mtr_id);
+	struct mlx5_flow_meter *fm;
+
+	if (!am)
+		return rte_flow_error_set(error, EINVAL,
+					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					  "meter action conf is NULL");
 
 	if (action_flags & MLX5_FLOW_ACTION_METER)
 		return rte_flow_error_set(error, ENOTSUP,
@@ -3417,6 +3422,8 @@ struct field_modify_info modify_tcp[] = {
 					  RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 					  NULL,
 					  "meter action not supported");
+
+	fm = mlx5_flow_meter_find(priv, am->mtr_id);
 	if (!fm)
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, NULL,
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-01-08 15:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-13 14:21 [dpdk-dev] [PATCH v2] net/mlx5: avoid crash when meter action conf is NULL xiangxia.m.yue
2019-12-16  1:29 ` Tonghao Zhang
2019-12-16  6:50   ` Suanming Mou
2020-01-07  6:39     ` Tonghao Zhang
2020-01-08  9:17       ` Raslan Darawsheh
2020-01-08 14:38         ` Ferruh Yigit
2020-01-08 15:09           ` Ferruh Yigit
2020-01-08 15:11           ` Raslan Darawsheh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).