Commit 0d9a5997 authored by Felix Manlunas's avatar Felix Manlunas Committed by David S. Miller

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: default avatarFelix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: default avatarDerek Chickles <derek.chickles@cavium.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e1e3ce62
...@@ -3698,6 +3698,9 @@ static int liquidio_set_vf_mac(struct net_device *netdev, int vfidx, u8 *mac) ...@@ -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; struct octeon_device *oct = lio->oct_dev;
int retval; int retval;
if (vfidx < 0 || vfidx >= oct->sriov_info.num_vfs_alloced)
return -EINVAL;
retval = __liquidio_set_vf_mac(netdev, vfidx, mac, true); retval = __liquidio_set_vf_mac(netdev, vfidx, mac, true);
if (!retval) if (!retval)
cn23xx_tell_vf_its_macaddr_changed(oct, vfidx, mac); cn23xx_tell_vf_its_macaddr_changed(oct, vfidx, mac);
......
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