[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5cef8fed5c7fbb9e7f18e61a2c9a47b45f87ca0d.1339404887.git.wpan@redhat.com>
Date: Mon, 11 Jun 2012 17:00:21 +0800
From: Weiping Pan <wpan@...hat.com>
To: netdev@...r.kernel.org
Subject: [PATCH net 2/3] bonding:check mode when modify primary_reselect
Using a primary_reselect only makes sense in active backup, TLB or ALB modes.
Signed-off-by: Weiping Pan <wpan@...hat.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 485bedb..1b0f3cd 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -1123,6 +1123,13 @@ static ssize_t bonding_store_primary_reselect(struct device *d,
if (!rtnl_trylock())
return restart_syscall();
+ if (!USES_PRIMARY(bond->params.mode)) {
+ pr_err("%s: Unable to set primary_reselect; %s is in mode %d\n",
+ bond->dev->name, bond->dev->name, bond->params.mode);
+ ret = -EINVAL;
+ goto out;
+ }
+
new_value = bond_parse_parm(buf, pri_reselect_tbl);
if (new_value < 0) {
pr_err("%s: Ignoring invalid primary_reselect value %.*s.\n",
--
1.7.4
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists