Commit 09a89c21 authored by Jiri Bohac's avatar Jiri Bohac Committed by David S. Miller

bonding: disallow enslaving a bond to itself

Enslaving a bond to itself leads to an endless loop and hangs the kernel.
Signed-off-by: default avatarJiri Bohac <jbohac@suse.cz>
Tested-by: default avatarDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ee6154e1
......@@ -1197,6 +1197,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) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment