netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wengang Wang <wen.gang.wang@oracle.com>
To: wwgwork@gmail.com, netdev@vger.kernel.org
Cc: wen.gang.wang@oracle.com
Subject: [PATCH] bonding: clear header_ops when last slave detached (v2)
Date: Wed, 19 Nov 2014 13:18:12 +0800	[thread overview]
Message-ID: <1416374292-10993-1-git-send-email-wen.gang.wang@oracle.com> (raw)

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

             reply	other threads:[~2014-11-19  5:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-19  5:18 Wengang Wang [this message]
2014-11-19  5:22 ` [PATCH] bonding: clear header_ops when last slave detached (v2) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1416374292-10993-1-git-send-email-wen.gang.wang@oracle.com \
    --to=wen.gang.wang@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=wwgwork@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).