net/mlx4_en: Avoid adding steering rules with invalid ring

Inserting steering rules with illegal ring is an invalid operation,
block it.

Fixes: 820672812f ('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>
This commit is contained in:
Talat Batheesh 2017-05-09 14:45:23 +03:00 коммит произвёл David S. Miller
Родитель 505a9249c2
Коммит 89c557687a
1 изменённых файлов: 5 добавлений и 0 удалений

Просмотреть файл

@ -1562,6 +1562,11 @@ static int mlx4_en_flow_replace(struct net_device *dev,
qpn = priv->drop_qp.qpn; qpn = priv->drop_qp.qpn;
else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) { else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1); qpn = cmd->fs.ring_cookie & (EN_ETHTOOL_QP_ATTACH - 1);
if (qpn < priv->rss_map.base_qpn ||
qpn >= priv->rss_map.base_qpn + priv->rx_ring_num) {
en_warn(priv, "rxnfc: QP (0x%x) doesn't exist\n", qpn);
return -EINVAL;
}
} else { } else {
if (cmd->fs.ring_cookie >= priv->rx_ring_num) { if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n", en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",