bonding: disallow enslaving a bond to itself
Subsystems (3)
PATCH 1/1 bonding: disallow enslaving a bond to itself
Enslaving a bond to itself leads to an endless loop and hangs the kernel.
Signed-off-by Jiri Bohac <[email protected]>
drivers/net/bonding/bond_main.c +5 -0
@@ -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 ) {
Signature · 2 lines
Jiri Bohac <[email protected]> SUSE Labs, SUSE CZ
Quoted 2 lines · Jiri Bohac
Enslaving a bond to itself leads to an endless loop and hangs the kernel.
Yes, I met the same problem.
Tested-by Ding Tianhong <[email protected]>
Quoted 19 lines
Signed-off-by Jiri Bohac <[email protected]>drivers/net/bonding/bond_main.c +5
-0@@ -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 ) {
From: Jiri Bohac <[email protected]>
Date: Wed, 26 Feb 2014 18:20:13 +0100
Quoted 3 lines
Enslaving a bond to itself leads to an endless loop and hangs the kernel.
Signed-off-by Jiri Bohac <[email protected]>
Applied, thank you.