Skip to content

Commit 89c5576

Browse files
talatbdavem330
authored andcommitted
net/mlx4_en: Avoid adding steering rules with invalid ring
Inserting steering rules with illegal ring is an invalid operation, block it. Fixes: 8206728 ('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>
1 parent 505a924 commit 89c5576

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/mellanox/mlx4/en_ethtool.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1562,6 +1562,11 @@ static int mlx4_en_flow_replace(struct net_device *dev,
15621562
qpn = priv->drop_qp.qpn;
15631563
else if (cmd->fs.ring_cookie & EN_ETHTOOL_QP_ATTACH) {
15641564
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+
}
15651570
} else {
15661571
if (cmd->fs.ring_cookie >= priv->rx_ring_num) {
15671572
en_warn(priv, "rxnfc: RX ring (%llu) doesn't exist\n",

0 commit comments

Comments
 (0)