diff options
author | Felix Manlunas <felix.manlunas@cavium.com> | 2017-05-16 11:28:00 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-17 14:48:29 -0400 |
commit | 0d9a5997842756f859032ae3efcaf79715a51883 (patch) | |
tree | bdca6bc0175f2ff5d56b526ba7925051092ac5eb | |
parent | e1e3ce623699d0cd594fa69f69371a9dbc55aa9a (diff) | |
download | linux-0d9a5997842756f859032ae3efcaf79715a51883.tar.bz2 |
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>
-rw-r--r-- | drivers/net/ethernet/cavium/liquidio/lio_main.c | 3 |
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); |