Patch "hv_netvsc: Make netvsc/VF binding check both MAC and serial number" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    hv_netvsc: Make netvsc/VF binding check both MAC and serial number

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     hv_netvsc-make-netvsc-vf-binding-check-both-mac-and-.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit d716ca09e4a57e4809e656010300dcdb7f40d4cb
Author: Dexuan Cui <decui@xxxxxxxxxxxxx>
Date:   Fri Apr 23 18:12:35 2021 -0700

    hv_netvsc: Make netvsc/VF binding check both MAC and serial number
    
    [ Upstream commit 64ff412ad41fe3a5bf759ff4844dc1382176485c ]
    
    Currently the netvsc/VF binding logic only checks the PCI serial number.
    
    The Microsoft Azure Network Adapter (MANA) supports multiple net_device
    interfaces (each such interface is called a "vPort", and has its unique
    MAC address) which are backed by the same VF PCI device, so the binding
    logic should check both the MAC address and the PCI serial number.
    
    The change should not break any other existing VF drivers, because
    Hyper-V NIC SR-IOV implementation requires the netvsc network
    interface and the VF network interface have the same MAC address.
    
    Co-developed-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
    Signed-off-by: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
    Co-developed-by: Shachar Raindel <shacharr@xxxxxxxxxxxxx>
    Signed-off-by: Shachar Raindel <shacharr@xxxxxxxxxxxxx>
    Acked-by: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>
    Signed-off-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Stable-dep-of: 9cae43da9867 ("hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed")
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 057b1a9dde153..9ec1633b89b48 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -2310,8 +2310,17 @@ static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev)
 		if (!ndev_ctx->vf_alloc)
 			continue;
 
-		if (ndev_ctx->vf_serial == serial)
-			return hv_get_drvdata(ndev_ctx->device_ctx);
+		if (ndev_ctx->vf_serial != serial)
+			continue;
+
+		ndev = hv_get_drvdata(ndev_ctx->device_ctx);
+		if (ndev->addr_len != vf_netdev->addr_len ||
+		    memcmp(ndev->perm_addr, vf_netdev->perm_addr,
+			   ndev->addr_len) != 0)
+			continue;
+
+		return ndev;
+
 	}
 
 	/* Fallback path to check synthetic vf with help of mac addr.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux