diff options
| author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-20 14:54:53 -0500 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2015-02-20 14:54:53 -0500 |
| commit | 4c971aa78314253cce914ed29e3d90df3326d646 (patch) | |
| tree | a9dcf0b1fdc9e1aacff90afb5b3ab79983115dcc /net/sched | |
| parent | 4ba24fef3eb3b142197135223b90ced2f319cd53 (diff) | |
| parent | 290b799c390d77d27effee3ce312203aaa32ee74 (diff) | |
Merge branch 'next' into for-linus
Second round of updates for 3.20.
Diffstat (limited to 'net/sched')
| -rw-r--r-- | net/sched/cls_api.c | 7 | ||||
| -rw-r--r-- | net/sched/cls_bpf.c | 15 | ||||
| -rw-r--r-- | net/sched/sch_fq.c | 10 |
3 files changed, 25 insertions, 7 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index aad6a679fb13..baef987fe2c0 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -556,8 +556,9 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst, | |||
| 556 | } | 556 | } |
| 557 | EXPORT_SYMBOL(tcf_exts_change); | 557 | EXPORT_SYMBOL(tcf_exts_change); |
| 558 | 558 | ||
| 559 | #define tcf_exts_first_act(ext) \ | 559 | #define tcf_exts_first_act(ext) \ |
| 560 | list_first_entry(&(exts)->actions, struct tc_action, list) | 560 | list_first_entry_or_null(&(exts)->actions, \ |
| 561 | struct tc_action, list) | ||
| 561 | 562 | ||
| 562 | int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) | 563 | int tcf_exts_dump(struct sk_buff *skb, struct tcf_exts *exts) |
| 563 | { | 564 | { |
| @@ -603,7 +604,7 @@ int tcf_exts_dump_stats(struct sk_buff *skb, struct tcf_exts *exts) | |||
| 603 | { | 604 | { |
| 604 | #ifdef CONFIG_NET_CLS_ACT | 605 | #ifdef CONFIG_NET_CLS_ACT |
| 605 | struct tc_action *a = tcf_exts_first_act(exts); | 606 | struct tc_action *a = tcf_exts_first_act(exts); |
| 606 | if (tcf_action_copy_stats(skb, a, 1) < 0) | 607 | if (a != NULL && tcf_action_copy_stats(skb, a, 1) < 0) |
| 607 | return -1; | 608 | return -1; |
| 608 | #endif | 609 | #endif |
| 609 | return 0; | 610 | return 0; |
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c index 84c8219c3e1c..f59adf8a4cd7 100644 --- a/net/sched/cls_bpf.c +++ b/net/sched/cls_bpf.c | |||
| @@ -180,6 +180,11 @@ static int cls_bpf_modify_existing(struct net *net, struct tcf_proto *tp, | |||
| 180 | } | 180 | } |
| 181 | 181 | ||
| 182 | bpf_size = bpf_len * sizeof(*bpf_ops); | 182 | bpf_size = bpf_len * sizeof(*bpf_ops); |
| 183 | if (bpf_size != nla_len(tb[TCA_BPF_OPS])) { | ||
| 184 | ret = -EINVAL; | ||
| 185 | goto errout; | ||
| 186 | } | ||
| 187 | |||
| 183 | bpf_ops = kzalloc(bpf_size, GFP_KERNEL); | 188 | bpf_ops = kzalloc(bpf_size, GFP_KERNEL); |
| 184 | if (bpf_ops == NULL) { | 189 | if (bpf_ops == NULL) { |
| 185 | ret = -ENOMEM; | 190 | ret = -ENOMEM; |
| @@ -215,15 +220,21 @@ static u32 cls_bpf_grab_new_handle(struct tcf_proto *tp, | |||
| 215 | struct cls_bpf_head *head) | 220 | struct cls_bpf_head *head) |
| 216 | { | 221 | { |
| 217 | unsigned int i = 0x80000000; | 222 | unsigned int i = 0x80000000; |
| 223 | u32 handle; | ||
| 218 | 224 | ||
| 219 | do { | 225 | do { |
| 220 | if (++head->hgen == 0x7FFFFFFF) | 226 | if (++head->hgen == 0x7FFFFFFF) |
| 221 | head->hgen = 1; | 227 | head->hgen = 1; |
| 222 | } while (--i > 0 && cls_bpf_get(tp, head->hgen)); | 228 | } while (--i > 0 && cls_bpf_get(tp, head->hgen)); |
| 223 | if (i == 0) | 229 | |
| 230 | if (unlikely(i == 0)) { | ||
| 224 | pr_err("Insufficient number of handles\n"); | 231 | pr_err("Insufficient number of handles\n"); |
| 232 | handle = 0; | ||
| 233 | } else { | ||
| 234 | handle = head->hgen; | ||
| 235 | } | ||
| 225 | 236 | ||
| 226 | return i; | 237 | return handle; |
| 227 | } | 238 | } |
| 228 | 239 | ||
| 229 | static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, | 240 | static int cls_bpf_change(struct net *net, struct sk_buff *in_skb, |
diff --git a/net/sched/sch_fq.c b/net/sched/sch_fq.c index 9b05924cc386..333cd94ba381 100644 --- a/net/sched/sch_fq.c +++ b/net/sched/sch_fq.c | |||
| @@ -670,8 +670,14 @@ static int fq_change(struct Qdisc *sch, struct nlattr *opt) | |||
| 670 | if (tb[TCA_FQ_FLOW_PLIMIT]) | 670 | if (tb[TCA_FQ_FLOW_PLIMIT]) |
| 671 | q->flow_plimit = nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]); | 671 | q->flow_plimit = nla_get_u32(tb[TCA_FQ_FLOW_PLIMIT]); |
| 672 | 672 | ||
| 673 | if (tb[TCA_FQ_QUANTUM]) | 673 | if (tb[TCA_FQ_QUANTUM]) { |
| 674 | q->quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); | 674 | u32 quantum = nla_get_u32(tb[TCA_FQ_QUANTUM]); |
| 675 | |||
| 676 | if (quantum > 0) | ||
| 677 | q->quantum = quantum; | ||
| 678 | else | ||
| 679 | err = -EINVAL; | ||
| 680 | } | ||
| 675 | 681 | ||
| 676 | if (tb[TCA_FQ_INITIAL_QUANTUM]) | 682 | if (tb[TCA_FQ_INITIAL_QUANTUM]) |
| 677 | q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); | 683 | q->initial_quantum = nla_get_u32(tb[TCA_FQ_INITIAL_QUANTUM]); |
