summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/cavium
diff options
context:
space:
mode:
authorFelix Manlunas <felix.manlunas@cavium.com>2017-05-16 11:28:00 -0700
committerDavid S. Miller <davem@davemloft.net>2017-05-17 14:48:29 -0400
commit0d9a5997842756f859032ae3efcaf79715a51883 (patch)
treebdca6bc0175f2ff5d56b526ba7925051092ac5eb /drivers/net/ethernet/cavium
parente1e3ce623699d0cd594fa69f69371a9dbc55aa9a (diff)
downloadblackbird-op-linux-0d9a5997842756f859032ae3efcaf79715a51883.tar.gz
blackbird-op-linux-0d9a5997842756f859032ae3efcaf79715a51883.zip
liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF
In the function assigned to .ndo_set_vf_mac, check the validity of the vfidx argument before proceeding to tell the firmware to set the VF MAC address. Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com> Signed-off-by: Derek Chickles <derek.chickles@cavium.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/cavium')
-rw-r--r--drivers/net/ethernet/cavium/liquidio/lio_main.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 360ddc8b2afb..649f2aaf0afb 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -3698,6 +3698,9 @@ static int liquidio_set_vf_mac(struct net_device *netdev, int vfidx, u8 *mac)
struct octeon_device *oct = lio->oct_dev;
int retval;
+ if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced)
+ return -EINVAL;
+
retval = __liquidio_set_vf_mac(netdev, vfidx, mac, true);
if (!retval)
cn23xx_tell_vf_its_macaddr_changed(oct, vfidx, mac);
OpenPOWER on IntegriCloud