Skip to content

Commit 0dbff14

Browse files
vittyvkdavem330
authored andcommitted
hv_netvsc: fix bonding devices check in netvsc_netdev_event()
Bonding driver sets IFF_BONDING on both master (the bonding device) and slave (the real NIC) devices and in netvsc_netdev_event() we want to skip master devices only. Currently, there is an uncertainty when a slave interface is removed: if bonding module comes first in netdev_chain it clears IFF_BONDING flag on the netdev and netvsc_netdev_event() correctly handles NETDEV_UNREGISTER event, but in case netvsc comes first on the chain it sees the device with IFF_BONDING still attached and skips it. As we still hold vf_netdev pointer to the device we crash on the next inject. Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com> Acked-by: Haiyang Zhang <haiyangz@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 0f20d79 commit 0dbff14

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

drivers/net/hyperv/netvsc_drv.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,8 +1482,13 @@ static int netvsc_netdev_event(struct notifier_block *this,
14821482
{
14831483
struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
14841484

1485-
/* Avoid Vlan, Bonding dev with same MAC registering as VF */
1486-
if (event_dev->priv_flags & (IFF_802_1Q_VLAN | IFF_BONDING))
1485+
/* Avoid Vlan dev with same MAC registering as VF */
1486+
if (event_dev->priv_flags & IFF_802_1Q_VLAN)
1487+
return NOTIFY_DONE;
1488+
1489+
/* Avoid Bonding master dev with same MAC registering as VF */
1490+
if (event_dev->priv_flags & IFF_BONDING &&
1491+
event_dev->flags & IFF_MASTER)
14871492
return NOTIFY_DONE;
14881493

14891494
switch (event) {

0 commit comments

Comments
 (0)