netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: clear header_ops when last slave detached (v2)
@ 2014-11-19  5:18 Wengang Wang
  2014-11-19  5:22 ` Wengang
  2014-11-19  5:39 ` Eric Dumazet
  0 siblings, 2 replies; 17+ messages in thread
From: Wengang Wang @ 2014-11-19  5:18 UTC (permalink / raw)
  To: wwgwork, netdev; +Cc: wen.gang.wang

When last slave of a bonding master is removed, the bonding then does not work.
When packet_snd is called against with a master net_device, it accesses
header_ops. In case the header_ops is not valid any longer(say ipoib module
unloaded), it will then access an invalid memory address.
This patch try to fix this issue by clearing header_ops when last slave
detached.

Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index c9ac06c..52a7e4b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1730,6 +1730,7 @@ static int __bond_release_one(struct net_device *bond_dev,
 	bond->slave_cnt--;
 
 	if (!bond_has_slaves(bond)) {
+		bond->dev->header_ops = NULL;
 		call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
 		call_netdevice_notifiers(NETDEV_RELEASE, bond->dev);
 	}
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-11-24  3:04 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-19  5:18 [PATCH] bonding: clear header_ops when last slave detached (v2) Wengang Wang
2014-11-19  5:22 ` Wengang
2014-11-19  5:39 ` Eric Dumazet
2014-11-19  7:00   ` Wengang
2014-11-19 22:26     ` Cong Wang
2014-11-19 22:56       ` Cong Wang
2014-11-20  6:41       ` Eric Dumazet
2014-11-20 17:34         ` Cong Wang
2014-11-20 20:41           ` Eric Dumazet
2014-11-20 21:57             ` Cong Wang
2014-11-20 22:03               ` Eric Dumazet
2014-11-20 22:13                 ` Cong Wang
2014-11-20 22:53                   ` Jay Vosburgh
2014-11-21 18:17                     ` Cong Wang
2014-11-21 18:54                       ` Jay Vosburgh
2014-11-24  3:05                         ` Wengang
2014-11-21 18:55                       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).