diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-12-23 04:16:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-23 16:51:18 -0500 |
commit | 2494654d4890316e7340fb8b3458daad0474a1b9 (patch) | |
tree | dcd0fcc707457b56b14b37053c288488872dd8f2 /net/sched/sch_netem.c | |
parent | f5a59b73321d9c6e6a9f0be4c8b563668f12c625 (diff) |
netem: loss model API sizes
The new netem loss model is configured with nested netlink messages.
This code is being overly strict about sizes, and is easily confused
by padding (or possible future expansion). Also message
for gemodel is incorrect.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_netem.c')
-rw-r--r-- | net/sched/sch_netem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index 1fa2f903d221..ffcaa5975947 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
@@ -605,7 +605,7 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr) | |||
605 | case NETEM_LOSS_GI: { | 605 | case NETEM_LOSS_GI: { |
606 | const struct tc_netem_gimodel *gi = nla_data(la); | 606 | const struct tc_netem_gimodel *gi = nla_data(la); |
607 | 607 | ||
608 | if (nla_len(la) != sizeof(struct tc_netem_gimodel)) { | 608 | if (nla_len(la) < sizeof(struct tc_netem_gimodel)) { |
609 | pr_info("netem: incorrect gi model size\n"); | 609 | pr_info("netem: incorrect gi model size\n"); |
610 | return -EINVAL; | 610 | return -EINVAL; |
611 | } | 611 | } |
@@ -624,8 +624,8 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr) | |||
624 | case NETEM_LOSS_GE: { | 624 | case NETEM_LOSS_GE: { |
625 | const struct tc_netem_gemodel *ge = nla_data(la); | 625 | const struct tc_netem_gemodel *ge = nla_data(la); |
626 | 626 | ||
627 | if (nla_len(la) != sizeof(struct tc_netem_gemodel)) { | 627 | if (nla_len(la) < sizeof(struct tc_netem_gemodel)) { |
628 | pr_info("netem: incorrect gi model size\n"); | 628 | pr_info("netem: incorrect ge model size\n"); |
629 | return -EINVAL; | 629 | return -EINVAL; |
630 | } | 630 | } |
631 | 631 | ||