aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/act_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sched/act_api.c')
-rw-r--r--net/sched/act_api.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index ea80f82dbb6a..87818d7fb623 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -473,17 +473,18 @@ struct tc_action *tcf_action_init_1(struct nlattr *nla, struct nlattr *est,
473 struct nlattr *kind; 473 struct nlattr *kind;
474 int err; 474 int err;
475 475
476 err = -EINVAL;
477
478 if (name == NULL) { 476 if (name == NULL) {
479 if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL) < 0) 477 err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
478 if (err < 0)
480 goto err_out; 479 goto err_out;
480 err = -EINVAL;
481 kind = tb[TCA_ACT_KIND]; 481 kind = tb[TCA_ACT_KIND];
482 if (kind == NULL) 482 if (kind == NULL)
483 goto err_out; 483 goto err_out;
484 if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ) 484 if (nla_strlcpy(act_name, kind, IFNAMSIZ) >= IFNAMSIZ)
485 goto err_out; 485 goto err_out;
486 } else { 486 } else {
487 err = -EINVAL;
487 if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ) 488 if (strlcpy(act_name, name, IFNAMSIZ) >= IFNAMSIZ)
488 goto err_out; 489 goto err_out;
489 } 490 }
@@ -548,10 +549,12 @@ struct tc_action *tcf_action_init(struct nlattr *nla, struct nlattr *est,
548{ 549{
549 struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; 550 struct nlattr *tb[TCA_ACT_MAX_PRIO+1];
550 struct tc_action *head = NULL, *act, *act_prev = NULL; 551 struct tc_action *head = NULL, *act, *act_prev = NULL;
552 int err;
551 int i; 553 int i;
552 554
553 if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL) < 0) 555 err = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL);
554 return ERR_PTR(-EINVAL); 556 if (err < 0)
557 return ERR_PTR(err);
555 558
556 for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) { 559 for (i = 1; i <= TCA_ACT_MAX_PRIO && tb[i]; i++) {
557 act = tcf_action_init_1(tb[i], est, name, ovr, bind); 560 act = tcf_action_init_1(tb[i], est, name, ovr, bind);
@@ -674,10 +677,11 @@ tcf_action_get_1(struct nlattr *nla, struct nlmsghdr *n, u32 pid)
674 int index; 677 int index;
675 int err; 678 int err;
676 679
677 err = -EINVAL; 680 err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
678 if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL) < 0) 681 if (err < 0)
679 goto err_out; 682 goto err_out;
680 683
684 err = -EINVAL;
681 if (tb[TCA_ACT_INDEX] == NULL || 685 if (tb[TCA_ACT_INDEX] == NULL ||
682 nla_len(tb[TCA_ACT_INDEX]) < sizeof(index)) 686 nla_len(tb[TCA_ACT_INDEX]) < sizeof(index))
683 goto err_out; 687 goto err_out;
@@ -759,9 +763,11 @@ static int tca_action_flush(struct nlattr *nla, struct nlmsghdr *n, u32 pid)
759 763
760 b = skb_tail_pointer(skb); 764 b = skb_tail_pointer(skb);
761 765
762 if (nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL) < 0) 766 err = nla_parse_nested(tb, TCA_ACT_MAX, nla, NULL);
767 if (err < 0)
763 goto err_out; 768 goto err_out;
764 769
770 err = -EINVAL;
765 kind = tb[TCA_ACT_KIND]; 771 kind = tb[TCA_ACT_KIND];
766 a->ops = tc_lookup_action(kind); 772 a->ops = tc_lookup_action(kind);
767 if (a->ops == NULL) 773 if (a->ops == NULL)
@@ -804,12 +810,13 @@ err_out:
804static int 810static int
805tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event) 811tca_action_gd(struct nlattr *nla, struct nlmsghdr *n, u32 pid, int event)
806{ 812{
807 int i, ret = 0; 813 int i, ret;
808 struct nlattr *tb[TCA_ACT_MAX_PRIO+1]; 814 struct nlattr *tb[TCA_ACT_MAX_PRIO+1];
809 struct tc_action *head = NULL, *act, *act_prev = NULL; 815 struct tc_action *head = NULL, *act, *act_prev = NULL;
810 816
811 if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL) < 0) 817 ret = nla_parse_nested(tb, TCA_ACT_MAX_PRIO, nla, NULL);
812 return -EINVAL; 818 if (ret < 0)
819 return ret;
813 820
814 if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) { 821 if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) {
815 if (tb[0] != NULL && tb[1] == NULL) 822 if (tb[0] != NULL && tb[1] == NULL)