From: Felix Manlunas Date: Tue, 16 May 2017 18:28:00 +0000 (-0700) Subject: liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=0d9a5997842756f859032ae3efcaf79715a51883;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Derek Chickles Signed-off-by: David S. Miller --- 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);