Skip to content

Commit

Permalink
net/mlx4_en: Avoid adding steering rules with invalid ring
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
talatb authored and davem330 committed May 9, 2017
1 parent 505a924 commit 89c5576
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/net/ethernet/mellanox/mlx4/en_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 89c5576

Please sign in to comment.