[dpdk-stable] [PATCH 26/33] net/mlx5: fix RSS flow action bounds check

Shahaf Shuler shahafs at mellanox.com
Sun May 6 08:05:55 CEST 2018


From: Adrien Mazarguil <adrien.mazarguil at 6wind.com>

[ upstream commit e68744e53ed209c0419925171c5aa510f6643adb ]

The number of queues provided by the application is not checked against
parser's supported maximum.

Fixes: 3d821d6fea40 ("net/mlx5: support RSS action flow rule")
Cc: stable at dpdk.org

Signed-off-by: Adrien Mazarguil <adrien.mazarguil at 6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro at 6wind.com>
Acked-by: Ferruh Yigit <ferruh.yigit at intel.com>
---
 drivers/net/mlx5/mlx5_flow.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 30b85731b0..48e9451313 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -16,6 +16,7 @@
 #pragma GCC diagnostic error "-Wpedantic"
 #endif
 
+#include <rte_common.h>
 #include <rte_ethdev_driver.h>
 #include <rte_flow.h>
 #include <rte_flow_driver.h>
@@ -707,6 +708,14 @@ mlx5_flow_convert_actions(struct rte_eth_dev *dev,
 					return -rte_errno;
 				}
 			}
+			if (rss->num > RTE_DIM(parser->queues)) {
+				rte_flow_error_set(error, EINVAL,
+						   RTE_FLOW_ERROR_TYPE_ACTION,
+						   actions,
+						   "too many queues for RSS"
+						   " context");
+				return -rte_errno;
+			}
 			for (n = 0; n < rss->num; ++n) {
 				if (rss->queue[n] >= priv->rxqs_n) {
 					rte_flow_error_set(error, EINVAL,
-- 
2.12.0



More information about the stable mailing list