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