]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF
authorFelix Manlunas <felix.manlunas@cavium.com>
Tue, 16 May 2017 18:28:00 +0000 (11:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 17 May 2017 18:48:29 +0000 (14:48 -0400)
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>
drivers/net/ethernet/cavium/liquidio/lio_main.c

index 360ddc8b2afb0617db61a32cfff6800d682c69ea..649f2aaf0afb41e1a2096134a54bb1c13a451c4c 100644 (file)
@@ -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);