diff options
author | Talat Batheesh <talatb@mellanox.com> | 2017-05-09 07:45:23 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-09 11:22:46 -0400 |
commit | 89c557687a32c294e9d25670a96e9287c09f2d5f (patch) | |
tree | e7f6943dc6504f915e8066caaa15fc129e1c7a27 | |
parent | 505a9249c23988768983aaa0766ce54e0dbe037d (diff) |
net/mlx4_en: Avoid adding steering rules with invalid ring
Inserting steering rules with illegal ring is an invalid operation,
block it.
Fixes: 820672812f82 ('net/mlx4_en: Manage flow steering rules with ethtool')
Signed-off-by: Talat Batheesh <talatb@mellanox.com>
Signed-off-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c index ffbcb27c05e5..ae5fdc2df654 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_ethtool.c | |||
@@ -1562,6 +1562,11 @@ static int mlx4_en_flow_replace(struct net_device *dev, | |||
1562 | qpn = priv->drop_qp.qpn; | 1562 | qpn = priv->drop_qp.qpn; |
1563 | else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { | 1563 | else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { |
1564 | qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); | 1564 | qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); |
1565 | if (qpn < priv->rss_map.base_qpn || | ||
1566 | qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) { | ||
1567 | en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn); | ||
1568 | return -EINVAL; | ||
1569 | } | ||
1565 | } else { | 1570 | } else { |
1566 | if (cmd->fs.ring_cookie >= priv->rx_ring_num) { | 1571 | if (cmd->fs.ring_cookie >= priv->rx_ring_num) { |
1567 | en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n", | 1572 | en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n", |