public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ding Tianhong <dingtianhong@huawei•com>
To: Jiri Bohac <jbohac@suse•cz>, Jay Vosburgh <fubar@us•ibm.com>
Cc: <netdev@vger•kernel.org>
Subject: Re: [PATCH] bonding: disallow enslaving a bond to itself
Date: Thu, 27 Feb 2014 09:30:56 +0800	[thread overview]
Message-ID: <530E9550.6030906@huawei.com> (raw)
In-Reply-To: <20140226172013.GA18145@midget.suse.cz>

On 2014/2/27 1:20, Jiri Bohac wrote:
> Enslaving a bond to itself leads to an endless loop and hangs the kernel.
> 

Yes, I met the same problem.

Tested-by: Ding Tianhong <dingtianhong@huawei•com>

> Signed-off-by: Jiri Bohac <jbohac@suse•cz>
> 
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 1c6104d..8f028ac 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1193,6 +1193,11 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
>  		return -EBUSY;
>  	}
>  
> +	if (bond_dev == slave_dev) {
> +		pr_err("%s: cannot enslave bond to itself.\n", bond_dev->name);
> +		return -EPERM;
> +	}
> +
>  	/* vlan challenged mutual exclusion */
>  	/* no need to lock since we're protected by rtnl_lock */
>  	if (slave_dev->features & NETIF_F_VLAN_CHALLENGED) {
> 

  reply	other threads:[~2014-02-27  1:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-26 17:20 [PATCH] bonding: disallow enslaving a bond to itself Jiri Bohac
2014-02-27  1:30 ` Ding Tianhong [this message]
2014-02-27  3:37 ` 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=530E9550.6030906@huawei.com \
    --to=dingtianhong@huawei$(echo .)com \
    --cc=fubar@us$(echo .)ibm.com \
    --cc=jbohac@suse$(echo .)cz \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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