bonding: do not save non-existent device to bond primary in sysfs
Subsystems (3)
PATCH 3/4 bonding: do not save non-existent device to bond primary in sysfs
Do not save non-existent device to bond primary in sysfs.
Signed-off-by Ding Tianhong <[email protected]>
--- drivers/net/bonding/bond_options.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/bonding/bond_options.c +6 -0
@@ -501,6 +501,12 @@ int bond_option_primary_set(struct bonding *bond, const char *primary) goto out; } +if (!__dev_get_by_name (dev_net (bond->dev), primary)) { +pr_err ("%s: unable to set non-existent device %s to primary.\n" , + bond->dev->name, primary); + goto out; + } +bond_for_each_slave (bond, slave, iter) {if (strncmp (slave->dev->name, primary,IFNAMSIZ ) ==0 ) { pr_info("%s: Setting %s as primary slave.\n",
Signature · 1 line
1.8.0
Quoted 1 line · Ding Tianhong
Do not save non-existent device to bond primary in sysfs.
Again, no - this interface might be enslaved after we've set the parameters, as it usually does.
Quoted 27 lines
Signed-off-by Ding Tianhong <[email protected]>---
drivers/net/bonding/bond_options.c| 6 ++++++1 file changed, 6 insertions(+)drivers/net/bonding/bond_options.c +6
-0@@ -501,6 +501,12 @@ int bond_option_primary_set(struct bonding *bond, const char *primary) goto out; } +if (!__dev_get_by_name (dev_net (bond->dev), primary)) { +pr_err ("%s: unable to set non-existent device %s to primary.\n" , + bond->dev->name, primary); + goto out; + } +bond_for_each_slave (bond, slave, iter) {if (strncmp (slave->dev->name, primary,IFNAMSIZ ) ==0 ) { pr_info("%s: Setting %s as primary slave.\n",Signature · 1 line
1.8.0