Commit 94f434c2 authored by Ajit Khaparde's avatar Ajit Khaparde Committed by David S. Miller

be2net: fix range check for set_qos for a VF

Signed-off-by: default avatarAjit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 80817cbf
...@@ -978,18 +978,22 @@ static int be_set_vf_tx_rate(struct net_device *netdev, ...@@ -978,18 +978,22 @@ static int be_set_vf_tx_rate(struct net_device *netdev,
if (!sriov_enabled(adapter)) if (!sriov_enabled(adapter))
return -EPERM; return -EPERM;
if (vf >= adapter->num_vfs || rate < 0) if (vf >= adapter->num_vfs)
return -EINVAL; return -EINVAL;
if (rate > 10000) if (rate < 100 || rate > 10000) {
rate = 10000; dev_err(&adapter->pdev->dev,
"tx rate must be between 100 and 10000 Mbps\n");
return -EINVAL;
}
adapter->vf_cfg[vf].tx_rate = rate;
status = be_cmd_set_qos(adapter, rate / 10, vf + 1); status = be_cmd_set_qos(adapter, rate / 10, vf + 1);
if (status) if (status)
dev_info(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"tx rate %d on VF %d failed\n", rate, vf); "tx rate %d on VF %d failed\n", rate, vf);
else
adapter->vf_cfg[vf].tx_rate = rate;
return status; return status;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment