netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wengang <wen.gang.wang@oracle.com>
To: Jay Vosburgh <jay.vosburgh@canonical.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH] [bonding]: clear header_ops when last slave detached
Date: Tue, 18 Nov 2014 09:56:22 +0800	[thread overview]
Message-ID: <546AA746.8090008@oracle.com> (raw)
In-Reply-To: <866.1416274729@famine>

Hi Jay,

于 2014年11月18日 09:38, Jay Vosburgh 写道:
> Wengang <wen.gang.wang@oracle.com> wrote:
>
>> Hi,
>>
>> Could anybody please review this patch?
> 	I don't see that the original of this ever came through netdev.

Oh, that' bad. I sent this to netdev@vger.kernel.org. The mail address 
is wrong?

>> thanks,
>> wengang
>>
>> 于 2014年11月13日 10:19, Wengang 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 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.
> 	Am I correct in presuming that this behavior is limited to ipoib
> slaves only?  I don't see that this could occur with ethernet slaves, as
> eth_header_ops isn't part of a module.  This needs to be mentioned in
> the commit log.
Yes, the problem is found with ipoib slaves.
>>> Signed-off-by: Wengang Wang <wen.gang.wang@oracle.com>
>>> ---
>>>    drivers/net/bonding/bond_main.c | 2 ++
>>>    1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>>> index c9ac06c..84a34fc 100644
>>> --- a/drivers/net/bonding/bond_main.c
>>> +++ b/drivers/net/bonding/bond_main.c
>>> @@ -1728,6 +1728,8 @@ static int __bond_release_one(struct net_device *bond_dev,
>>>    	unblock_netpoll_tx();
>>>    	synchronize_rcu();
>>>    	bond->slave_cnt--;
>>> +	if (!bond->slave_cnt)
>>> +		bond->dev->header_ops = NULL;
>>>      	if (!bond_has_slaves(bond)) {
>>>    		call_netdevice_notifiers(NETDEV_CHANGEADDR, bond->dev);
> 	I believe your addition could be moved into the block for the
> next if, as "!bond->slave_cnt" is essentially "!bond_has_slaves()".

Yes, Agree.
I will send the second prompt soon with commit message mentioning ipoib.

thanks,
wengang

> 	-J
>
> ---
> 	-Jay Vosburgh, jay.vosburgh@canonical.com

  reply	other threads:[~2014-11-18  1:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1415845156-15461-1-git-send-email-wen.gang.wang@oracle.com>
2014-11-17  1:19 ` [PATCH] [bonding]: clear header_ops when last slave detached Wengang
2014-11-18  1:38   ` Jay Vosburgh
2014-11-18  1:56     ` Wengang [this message]
2014-11-18  2:19       ` Eric Dumazet
2014-11-18  2:58         ` Jay Vosburgh

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=546AA746.8090008@oracle.com \
    --to=wen.gang.wang@oracle.com \
    --cc=jay.vosburgh@canonical.com \
    --cc=netdev@vger.kernel.org \
    /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).