summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-12-23 09:16:30 +0000
committerDavid S. Miller <davem@davemloft.net>2011-12-23 16:51:18 -0500
commit2494654d4890316e7340fb8b3458daad0474a1b9 (patch)
treedcd0fcc707457b56b14b37053c288488872dd8f2
parentf5a59b73321d9c6e6a9f0be4c8b563668f12c625 (diff)
downloadlinux-2494654d4890316e7340fb8b3458daad0474a1b9.tar.bz2
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>
-rw-r--r--net/sched/sch_netem.c6
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)
case NETEM_LOSS_GI: {
const struct tc_netem_gimodel *gi = nla_data(la);
- if (nla_len(la) != sizeof(struct tc_netem_gimodel)) {
+ if (nla_len(la) < sizeof(struct tc_netem_gimodel)) {
pr_info("netem: incorrect gi model size\n");
return -EINVAL;
}
@@ -624,8 +624,8 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr)
case NETEM_LOSS_GE: {
const struct tc_netem_gemodel *ge = nla_data(la);
- if (nla_len(la) != sizeof(struct tc_netem_gemodel)) {
- pr_info("netem: incorrect gi model size\n");
+ if (nla_len(la) < sizeof(struct tc_netem_gemodel)) {
+ pr_info("netem: incorrect ge model size\n");
return -EINVAL;
}