[PATCH 4.14 236/496] hv_netvsc: fix locking during VF setup

From: Greg Kroah-Hartman
Date: Mon May 28 2018 - 09:08:45 EST


4.14-stable review patch. If anyone has any objections, please let me know.

------------------

From: Stephen Hemminger <stephen@xxxxxxxxxxxxxxxxxx>

[ Upstream commit b0dee7910317f41f398838992516af6a3b981d86 ]

The dev_uc/mc_sync calls need to have the device address list
locked. This was spotted by running with lockdep enabled.

Fixes: bee9d41b37ea ("hv_netvsc: propagate rx filters to VF")
Signed-off-by: Stephen Hemminger <sthemmin@xxxxxxxxxxxxx>
Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
---
drivers/net/hyperv/netvsc_drv.c | 4 ++++
1 file changed, 4 insertions(+)

--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1848,8 +1848,12 @@ static void __netvsc_vf_setup(struct net

/* set multicast etc flags on VF */
dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE);
+
+ /* sync address list from ndev to VF */
+ netif_addr_lock_bh(ndev);
dev_uc_sync(vf_netdev, ndev);
dev_mc_sync(vf_netdev, ndev);
+ netif_addr_unlock_bh(ndev);

if (netif_running(ndev)) {
ret = dev_open(vf_netdev);