diff mbox series

net/mlx5: fix zero value check for set tag action

Message ID 1583759523-25392-1-git-send-email-wisamm@mellanox.com (mailing list archive)
State Rejected, archived
Delegated to: Raslan Darawsheh
Headers show
Series net/mlx5: fix zero value check for set tag action | expand

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/checkpatch success coding style OK

Commit Message

Wisam Jaddo March 9, 2020, 1:12 p.m. UTC
If we allow to have data <xxx> and mask <0x0> we might
hit a zero data value that will not do any effect

Fixes: e554b672aa05 ("net/mlx5: support flow tag")
Cc: viacheslavo@mellanox.com
Cc: stable@dpdk.org

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Wisam Jaddo March 12, 2020, 9:35 a.m. UTC | #1
-----Original Message-----
From: Wisam Monther <wisamm@mellanox.com> 
Sent: Monday, March 9, 2020 3:13 PM
To: dev@dpdk.org; Raslan Darawsheh <rasland@mellanox.com>; Matan Azrad <matan@mellanox.com>
Cc: Slava Ovsiienko <viacheslavo@mellanox.com>; stable@dpdk.org
Subject: [PATCH] net/mlx5: fix zero value check for set tag action

If we allow to have data <xxx> and mask <0x0> we might hit a zero data value that will not do any effect

Fixes: e554b672aa05 ("net/mlx5: support flow tag")
Cc: viacheslavo@mellanox.com
Cc: stable@dpdk.org

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index e7278f0..edd0065 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2160,6 +2160,10 @@ flow_dv_validate_action_set_tag(struct rte_eth_dev *dev,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "zero mask doesn't have any effect");
+	if (!(conf->data & conf->mask))
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"zero value has no effect");
 	ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, conf->index, error);
 	if (ret < 0)
 		return ret;
--
2.7.4

Hey Guys,

This patch not relevant anymore

Thanks,
Wisam Jaddo
diff mbox series

Patch

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index e7278f0..edd0065 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -2160,6 +2160,10 @@  flow_dv_validate_action_set_tag(struct rte_eth_dev *dev,
 		return rte_flow_error_set(error, EINVAL,
 					  RTE_FLOW_ERROR_TYPE_ACTION, action,
 					  "zero mask doesn't have any effect");
+	if (!(conf->data & conf->mask))
+		return rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, action,
+					"zero value has no effect");
 	ret = mlx5_flow_get_reg_id(dev, MLX5_APP_TAG, conf->index, error);
 	if (ret < 0)
 		return ret;