netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bonding: Don't allow mode change via sysfs with slaves present
@ 2011-11-15 16:44 Veaceslav Falico
  2011-11-15 17:00 ` Andy Gospodarek
  2011-11-17 21:04 ` David Miller
  0 siblings, 2 replies; 15+ messages in thread
From: Veaceslav Falico @ 2011-11-15 16:44 UTC (permalink / raw)
  To: netdev; +Cc: Andy Gospodarek, Jay Vosburgh

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>
---
 drivers/net/bonding/bond_sysfs.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 5a20804..4ef7e2f 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,
 		goto out;
 	}
 
+	if (bond->slave_cnt > 0) {
+		pr_err("unable to update mode of %s because it has slaves.\n",
+			bond->dev->name);
+		ret = -EPERM;
+		goto out;
+	}
+
 	new_value = bond_parse_parm(buf, bond_mode_tbl);
 	if (new_value < 0)  {
 		pr_err("%s: Ignoring invalid mode value %.*s.\n",
-- 
1.7.6.4

^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2011-11-18  0:32 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 16:44 [PATCH] bonding: Don't allow mode change via sysfs with slaves present Veaceslav Falico
2011-11-15 17:00 ` Andy Gospodarek
2011-11-15 19:24   ` Nicolas de Pesloüan
2011-11-15 19:33     ` Ben Hutchings
2011-11-15 19:35     ` Andy Gospodarek
2011-11-15 20:02       ` Nicolas de Pesloüan
2011-11-15 20:47         ` Andy Gospodarek
2011-11-16 12:02           ` Nicolas de Pesloüan
2011-11-16 22:02             ` Andy Gospodarek
2011-11-17  1:16               ` Flavio Leitner
2011-11-17 21:28               ` Nicolas de Pesloüan
2011-11-15 21:04     ` Veaceslav Falico
2011-11-17 21:04 ` David Miller
2011-11-17 22:36   ` Nicolas de Pesloüan
2011-11-18  0:32     ` 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).