DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number
@ 2018-11-28  9:16 Dekel Peled
  2018-12-06 11:34 ` Shahaf Shuler
  0 siblings, 1 reply; 2+ messages in thread
From: Dekel Peled @ 2018-11-28  9:16 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, orika, dekelp, nelio.laranjeiro

Function mlx5_ctrl_flow_vlan() is used to set the rss rule in
MLX5 PMD, using priv->reta_idx_n as number of Rx queues.
This number is passed to mlx5_flow_validate_action_rss(), which
attempts to access the Rx queues at priv->rxqs.
In case priv->rxqs_n is 0, priv->rxqs is empty, and
mlx5_flow_validate_action_rss() will crash with segmentation fault.

priv->reta_idx_n can never be 0, even if priv->rxqs_n is set to 0.
But when priv->rxqs_n is set to 0, setting the rss rule is invalid.

This patch updates mlx5_ctrl_flow_vlan(), if priv->rxqs_n is 0 the
function will fail with EINVAL errno.

Fixes: 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
Cc: nelio.laranjeiro@6wind.com

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 97dc3e1..ee129b9 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2314,7 +2314,7 @@ struct rte_flow *
 	struct rte_flow_error error;
 	unsigned int i;
 
-	if (!priv->reta_idx_n) {
+	if (!priv->reta_idx_n || !priv->rxqs_n) {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
-- 
1.8.3.1

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number
  2018-11-28  9:16 [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number Dekel Peled
@ 2018-12-06 11:34 ` Shahaf Shuler
  0 siblings, 0 replies; 2+ messages in thread
From: Shahaf Shuler @ 2018-12-06 11:34 UTC (permalink / raw)
  To: Dekel Peled, Yongseok Koh
  Cc: dev, Ori Kam, Dekel Peled, Nélio Laranjeiro

Wednesday, November 28, 2018 11:16 AM, Dekel Peled:
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number
> 
> Function mlx5_ctrl_flow_vlan() is used to set the rss rule in
> MLX5 PMD, using priv->reta_idx_n as number of Rx queues.
> This number is passed to mlx5_flow_validate_action_rss(), which attempts
> to access the Rx queues at priv->rxqs.
> In case priv->rxqs_n is 0, priv->rxqs is empty, and
> mlx5_flow_validate_action_rss() will crash with segmentation fault.
> 
> priv->reta_idx_n can never be 0, even if priv->rxqs_n is set to 0.
> But when priv->rxqs_n is set to 0, setting the rss rule is invalid.
> 
> This patch updates mlx5_ctrl_flow_vlan(), if priv->rxqs_n is 0 the function will
> fail with EINVAL errno.
> 
> Fixes: 8086cf08b2f0 ("net/mlx5: handle RSS hash configuration in RSS flow")
> Cc: nelio.laranjeiro@6wind.com
> 
> Signed-off-by: Dekel Peled <dekelp@mellanox.com>

Applied to next-net-mlx, thanks. 

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

end of thread, other threads:[~2018-12-06 11:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-28  9:16 [dpdk-dev] [PATCH] net/mlx5: fix validation of Rx queue number Dekel Peled
2018-12-06 11:34 ` Shahaf Shuler

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