]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net/mlx4_en: Avoid adding steering rules with invalid ring
authorTalat Batheesh <talatb@mellanox.com>
Tue, 9 May 2017 11:45:23 +0000 (14:45 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 May 2017 15:22:46 +0000 (11:22 -0400)
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>
drivers/net/ethernet/mellanox/mlx4/en_ethtool.c

index ffbcb27c05e55f43630a812249bab21609886dd9..ae5fdc2df65412afce4e72b8384c9c4b3302c56e 100644 (file)
@@ -1562,6 +1562,11 @@ static int mlx4_en_flow_replace(struct net_device *dev,
                qpn = priv->drop_qp.qpn;
        else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
                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 {
                if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
                        en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",