diff options
Diffstat (limited to 'drivers/net/bonding/bond_sysfs.c')
-rw-r--r-- | drivers/net/bonding/bond_sysfs.c | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c index bc8fd362a5aa..0ec2a7e8c8a9 100644 --- a/drivers/net/bonding/bond_sysfs.c +++ b/drivers/net/bonding/bond_sysfs.c | |||
@@ -524,8 +524,9 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |||
524 | goto out; | 524 | goto out; |
525 | } | 525 | } |
526 | if (bond->params.mode == BOND_MODE_ALB || | 526 | if (bond->params.mode == BOND_MODE_ALB || |
527 | bond->params.mode == BOND_MODE_TLB) { | 527 | bond->params.mode == BOND_MODE_TLB || |
528 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB. Only MII monitoring is supported on %s.\n", | 528 | bond->params.mode == BOND_MODE_8023AD) { |
529 | pr_info("%s: ARP monitoring cannot be used with ALB/TLB/802.3ad. Only MII monitoring is supported on %s.\n", | ||
529 | bond->dev->name, bond->dev->name); | 530 | bond->dev->name, bond->dev->name); |
530 | ret = -EINVAL; | 531 | ret = -EINVAL; |
531 | goto out; | 532 | goto out; |
@@ -603,15 +604,14 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
603 | return restart_syscall(); | 604 | return restart_syscall(); |
604 | 605 | ||
605 | targets = bond->params.arp_targets; | 606 | targets = bond->params.arp_targets; |
606 | newtarget = in_aton(buf + 1); | 607 | if (!in4_pton(buf + 1, -1, (u8 *)&newtarget, -1, NULL) || |
608 | IS_IP_TARGET_UNUSABLE_ADDRESS(newtarget)) { | ||
609 | pr_err("%s: invalid ARP target %pI4 specified for addition\n", | ||
610 | bond->dev->name, &newtarget); | ||
611 | goto out; | ||
612 | } | ||
607 | /* look for adds */ | 613 | /* look for adds */ |
608 | if (buf[0] == '+') { | 614 | if (buf[0] == '+') { |
609 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | ||
610 | pr_err("%s: invalid ARP target %pI4 specified for addition\n", | ||
611 | bond->dev->name, &newtarget); | ||
612 | goto out; | ||
613 | } | ||
614 | |||
615 | if (bond_get_targets_ip(targets, newtarget) != -1) { /* dup */ | 615 | if (bond_get_targets_ip(targets, newtarget) != -1) { /* dup */ |
616 | pr_err("%s: ARP target %pI4 is already present\n", | 616 | pr_err("%s: ARP target %pI4 is already present\n", |
617 | bond->dev->name, &newtarget); | 617 | bond->dev->name, &newtarget); |
@@ -634,12 +634,6 @@ static ssize_t bonding_store_arp_targets(struct device *d, | |||
634 | targets[ind] = newtarget; | 634 | targets[ind] = newtarget; |
635 | write_unlock_bh(&bond->lock); | 635 | write_unlock_bh(&bond->lock); |
636 | } else if (buf[0] == '-') { | 636 | } else if (buf[0] == '-') { |
637 | if ((newtarget == 0) || (newtarget == htonl(INADDR_BROADCAST))) { | ||
638 | pr_err("%s: invalid ARP target %pI4 specified for removal\n", | ||
639 | bond->dev->name, &newtarget); | ||
640 | goto out; | ||
641 | } | ||
642 | |||
643 | ind = bond_get_targets_ip(targets, newtarget); | 637 | ind = bond_get_targets_ip(targets, newtarget); |
644 | if (ind == -1) { | 638 | if (ind == -1) { |
645 | pr_err("%s: unable to remove nonexistent ARP target %pI4.\n", | 639 | pr_err("%s: unable to remove nonexistent ARP target %pI4.\n", |
@@ -701,6 +695,8 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
701 | int new_value, ret = count; | 695 | int new_value, ret = count; |
702 | struct bonding *bond = to_bond(d); | 696 | struct bonding *bond = to_bond(d); |
703 | 697 | ||
698 | if (!rtnl_trylock()) | ||
699 | return restart_syscall(); | ||
704 | if (!(bond->params.miimon)) { | 700 | if (!(bond->params.miimon)) { |
705 | pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", | 701 | pr_err("%s: Unable to set down delay as MII monitoring is disabled\n", |
706 | bond->dev->name); | 702 | bond->dev->name); |
@@ -734,6 +730,7 @@ static ssize_t bonding_store_downdelay(struct device *d, | |||
734 | } | 730 | } |
735 | 731 | ||
736 | out: | 732 | out: |
733 | rtnl_unlock(); | ||
737 | return ret; | 734 | return ret; |
738 | } | 735 | } |
739 | static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR, | 736 | static DEVICE_ATTR(downdelay, S_IRUGO | S_IWUSR, |
@@ -756,6 +753,8 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
756 | int new_value, ret = count; | 753 | int new_value, ret = count; |
757 | struct bonding *bond = to_bond(d); | 754 | struct bonding *bond = to_bond(d); |
758 | 755 | ||
756 | if (!rtnl_trylock()) | ||
757 | return restart_syscall(); | ||
759 | if (!(bond->params.miimon)) { | 758 | if (!(bond->params.miimon)) { |
760 | pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", | 759 | pr_err("%s: Unable to set up delay as MII monitoring is disabled\n", |
761 | bond->dev->name); | 760 | bond->dev->name); |
@@ -789,6 +788,7 @@ static ssize_t bonding_store_updelay(struct device *d, | |||
789 | } | 788 | } |
790 | 789 | ||
791 | out: | 790 | out: |
791 | rtnl_unlock(); | ||
792 | return ret; | 792 | return ret; |
793 | } | 793 | } |
794 | static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR, | 794 | static DEVICE_ATTR(updelay, S_IRUGO | S_IWUSR, |