aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2011-11-15 01:44:42 -0500
committerDavid S. Miller <davem@davemloft.net>2011-11-17 19:31:54 -0500
commit4a8bb7e27fbb68da888b55f26defd2855225b2d5 (patch)
tree3eed4c74cbfceea961a8c18c3de1848b60be2437
parent596a1b746c56f974240c8df6d8e3a026c54266ff (diff)
bonding: Don't allow mode change via sysfs with slaves present
When changing mode via bonding's sysfs, the slaves are not initialized correctly. Forbid to change modes with slaves present to ensure that every slave is initialized correctly via bond_enslave(). Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: Andy Gospodarek <andy@greyhouse.net> Acked-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_sysfs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5a20804fdece..4ef7e2fd9fe6 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -319,6 +319,13 @@ static ssize_t bonding_store_mode(struct device *d,
319 goto out; 319 goto out;
320 } 320 }
321 321
322 if (bond->slave_cnt > 0) {
323 pr_err("unable to update mode of %s because it has slaves.\n",
324 bond->dev->name);
325 ret = -EPERM;
326 goto out;
327 }
328
322 new_value = bond_parse_parm(buf, bond_mode_tbl); 329 new_value = bond_parse_parm(buf, bond_mode_tbl);
323 if (new_value < 0) { 330 if (new_value < 0) {
324 pr_err("%s: Ignoring invalid mode value %.*s.\n", 331 pr_err("%s: Ignoring invalid mode value %.*s.\n",