diff options
Diffstat (limited to 'net/sched/act_api.c')
| -rw-r--r-- | net/sched/act_api.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 26c7e1f9a350..9974b3f04f05 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
| @@ -751,7 +751,7 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | |||
| 751 | struct nlattr *tb[TCA_ACT_MAX+1]; | 751 | struct nlattr *tb[TCA_ACT_MAX+1]; |
| 752 | struct nlattr *kind; | 752 | struct nlattr *kind; |
| 753 | struct tc_action *a = create_a(0); | 753 | struct tc_action *a = create_a(0); |
| 754 | int err = -EINVAL; | 754 | int err = -ENOMEM; |
| 755 | 755 | ||
| 756 | if (a == NULL) { | 756 | if (a == NULL) { |
| 757 | printk("tca_action_flush: couldnt create tc_action\n"); | 757 | printk("tca_action_flush: couldnt create tc_action\n"); |
| @@ -762,7 +762,7 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | |||
| 762 | if (!skb) { | 762 | if (!skb) { |
| 763 | printk("tca_action_flush: failed skb alloc\n"); | 763 | printk("tca_action_flush: failed skb alloc\n"); |
| 764 | kfree(a); | 764 | kfree(a); |
| 765 | return -ENOBUFS; | 765 | return err; |
| 766 | } | 766 | } |
| 767 | 767 | ||
| 768 | b = skb_tail_pointer(skb); | 768 | b = skb_tail_pointer(skb); |
| @@ -790,6 +790,8 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid) | |||
| 790 | err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); | 790 | err = a->ops->walk(skb, &dcb, RTM_DELACTION, a); |
| 791 | if (err < 0) | 791 | if (err < 0) |
| 792 | goto nla_put_failure; | 792 | goto nla_put_failure; |
| 793 | if (err == 0) | ||
| 794 | goto noflush_out; | ||
| 793 | 795 | ||
| 794 | nla_nest_end(skb, nest); | 796 | nla_nest_end(skb, nest); |
| 795 | 797 | ||
| @@ -807,6 +809,7 @@ nla_put_failure: | |||
| 807 | nlmsg_failure: | 809 | nlmsg_failure: |
| 808 | module_put(a->ops->owner); | 810 | module_put(a->ops->owner); |
| 809 | err_out: | 811 | err_out: |
| 812 | noflush_out: | ||
| 810 | kfree_skb(skb); | 813 | kfree_skb(skb); |
| 811 | kfree(a); | 814 | kfree(a); |
| 812 | return err; | 815 | return err; |
| @@ -824,8 +827,10 @@ tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) | |||
| 824 | return ret; | 827 | return ret; |
| 825 | 828 | ||
| 826 | if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { | 829 | if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { |
| 827 | if (tb[0] != NULL && tb[1] == NULL) | 830 | if (tb[1] != NULL) |
| 828 | return tca_action_flush(tb[0], n, pid); | 831 | return tca_action_flush(tb[1], n, pid); |
| 832 | else | ||
| 833 | return -EINVAL; | ||
| 829 | } | 834 | } |
| 830 | 835 | ||
| 831 | for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { | 836 | for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { |
