Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1462940 > unrolled thread

[PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()

Started byVitaly Kuznetsov <vkuznets@redhat.com>
First post2016-08-15 17:50 +0200
Last post2016-08-15 18:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event() Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-08-15 17:50 +0200
    RE: [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in  netvsc_netdev_event() Haiyang Zhang <haiyangz@microsoft.com> - 2016-08-15 18:00 +0200

#1462940 — [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()

FromVitaly Kuznetsov <vkuznets@redhat.com>
Date2016-08-15 17:50 +0200
Subject[PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()
Message-ID<s6sjf-7pG-7@gated-at.bofh.it>
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>
---
 drivers/net/hyperv/netvsc_drv.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 62a4e6e..3ba29fc 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1482,8 +1482,13 @@ static int netvsc_netdev_event(struct notifier_block *this,
 {
 	struct net_device *event_dev = netdev_notifier_info_to_dev(ptr);
 
-	/* Avoid Vlan, Bonding dev with same MAC registering as VF */
-	if (event_dev->priv_flags & (IFF_802_1Q_VLAN | IFF_BONDING))
+	/* Avoid Vlan dev with same MAC registering as VF */
+	if (event_dev->priv_flags & IFF_802_1Q_VLAN)
+		return NOTIFY_DONE;
+
+	/* Avoid Bonding master dev with same MAC registering as VF */
+	if (event_dev->priv_flags & IFF_BONDING &&
+	    event_dev->flags & IFF_MASTER)
 		return NOTIFY_DONE;
 
 	switch (event) {
-- 
2.7.4

[toc] | [next] | [standalone]


#1462956 — RE: [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()

FromHaiyang Zhang <haiyangz@microsoft.com>
Date2016-08-15 18:00 +0200
SubjectRE: [PATCH net v2 5/5] hv_netvsc: fix bonding devices check in netvsc_netdev_event()
Message-ID<s6ssV-7sK-13@gated-at.bofh.it>
In reply to#1462940

> -----Original Message-----
> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
> Sent: Monday, August 15, 2016 11:49 AM
> To: netdev@vger.kernel.org
> Cc: devel@linuxdriverproject.org; linux-kernel@vger.kernel.org; Haiyang
> Zhang <haiyangz@microsoft.com>; KY Srinivasan <kys@microsoft.com>;
> Stephen Hemminger <stephen@networkplumber.org>
> Subject: [PATCH net v2 5/5] 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>

Thanks!

Acked-by: Haiyang Zhang <haiyangz@microsoft.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web