* [PATCH] bonding: disallow enslaving a bond to itself
@ 2014-02-26 17:20 Jiri Bohac
2014-02-27 1:30 ` Ding Tianhong
2014-02-27 3:37 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Jiri Bohac @ 2014-02-26 17:20 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: netdev
Enslaving a bond to itself leads to an endless loop and hangs the kernel.
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) {
--
Jiri Bohac <jbohac@suse.cz>
SUSE Labs, SUSE CZ
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bonding: disallow enslaving a bond to itself
2014-02-26 17:20 [PATCH] bonding: disallow enslaving a bond to itself Jiri Bohac
@ 2014-02-27 1:30 ` Ding Tianhong
2014-02-27 3:37 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Ding Tianhong @ 2014-02-27 1:30 UTC (permalink / raw)
To: Jiri Bohac, Jay Vosburgh; +Cc: netdev
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) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bonding: disallow enslaving a bond to itself
2014-02-26 17:20 [PATCH] bonding: disallow enslaving a bond to itself Jiri Bohac
2014-02-27 1:30 ` Ding Tianhong
@ 2014-02-27 3:37 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-02-27 3:37 UTC (permalink / raw)
To: jbohac; +Cc: fubar, netdev
From: Jiri Bohac <jbohac@suse.cz>
Date: Wed, 26 Feb 2014 18:20:13 +0100
> Enslaving a bond to itself leads to an endless loop and hangs the kernel.
>
> Signed-off-by: Jiri Bohac <jbohac@suse.cz>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-27 3:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-26 17:20 [PATCH] bonding: disallow enslaving a bond to itself Jiri Bohac
2014-02-27 1:30 ` Ding Tianhong
2014-02-27 3:37 ` 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).