liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF

This change “liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF” (commit 0d9a599) in Linux kernel is authored by Felix Manlunas <felix.manlunas [at] cavium.com> on Tue May 16 11:28:00 2017 -0700.

Description of "liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF"

The change “liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF” introduces changes as follows.

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>

Linux kernel releases containing commit 0d9a599

The Linux kernel releases containing this commit are as follows.

Linux kernel code changes from "liquidio: fix PF falsely indicating success at setting MAC address of a nonexistent VF"

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/net/ethernet/cavium/liquidio/lio_main.c | 3 +++
 1 file changed, 3 insertions(+)
 
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);

The commit for this change in Linux stable tree is 0d9a599 (patch).

Last modified: 2020/02/09