diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index ce4677668e2c..4e386836d34f 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -419,27 +419,33 @@ static ssize_t bonding_store_arp_validate(struct device *d, | |||
419 | struct device_attribute *attr, | 419 | struct device_attribute *attr, |
420 | const char *buf, size_t count) | 420 | const char *buf, size_t count) |
421 | { | 421 | { |
422 | int new_value; | 422 | int new_value, ret = count; |
423 | struct bonding *bond = to_bond(d); | 423 | struct bonding *bond = to_bond(d); |
424 | 424 | ||
425 | if (!rtnl_trylock()) | ||
426 | return restart_syscall(); | ||
425 | new_value = bond_parse_parm(buf, arp_validate_tbl); | 427 | new_value = bond_parse_parm(buf, arp_validate_tbl); |
426 | if (new_value < 0) { | 428 | if (new_value < 0) { |
427 | pr_err("%s: Ignoring invalid arp_validate value %s\n", | 429 | pr_err("%s: Ignoring invalid arp_validate value %s\n", |
428 | bond->dev->name, buf); | 430 | bond->dev->name, buf); |
429 | return -EINVAL; | 431 | ret = -EINVAL; |
432 | goto out; | ||
430 | } | 433 | } |
431 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { | 434 | if (new_value && (bond->params.mode != BOND_MODE_ACTIVEBACKUP)) { |
432 | pr_err("%s: arp_validate only supported in active-backup mode.\n", | 435 | pr_err("%s: arp_validate only supported in active-backup mode.\n", |
433 | bond->dev->name); | 436 | bond->dev->name); |
434 | return -EINVAL; | 437 | ret = -EINVAL; |
438 | goto out; | ||
435 | } | 439 | } |
436 | pr_info("%s: setting arp_validate to %s (%d).\n", | 440 | pr_info("%s: setting arp_validate to %s (%d).\n", |
437 | bond->dev->name, arp_validate_tbl[new_value].modename, | 441 | bond->dev->name, arp_validate_tbl[new_value].modename, |
438 | new_value); | 442 | new_value); |
439 | 443 | ||
440 | bond->params.arp_validate = new_value; | 444 | bond->params.arp_validate = new_value; |
445 | out: | ||
446 | rtnl_unlock(); | ||
441 | 447 | ||
442 | return count; | 448 | return ret; |
443 | } | 449 | } |
444 | 450 | ||
445 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, | 451 | static DEVICE_ATTR(arp_validate, S_IRUGO | S_IWUSR, bonding_show_arp_validate, |