Commit 2494654d authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f5a59b73
...@@ -605,7 +605,7 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr) ...@@ -605,7 +605,7 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr)
case NETEM_LOSS_GI: { case NETEM_LOSS_GI: {
const struct tc_netem_gimodel *gi = nla_data(la); 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"); pr_info("netem: incorrect gi model size\n");
return -EINVAL; return -EINVAL;
} }
...@@ -624,8 +624,8 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr) ...@@ -624,8 +624,8 @@ static int get_loss_clg(struct Qdisc *sch, const struct nlattr *attr)
case NETEM_LOSS_GE: { case NETEM_LOSS_GE: {
const struct tc_netem_gemodel *ge = nla_data(la); const struct tc_netem_gemodel *ge = nla_data(la);
if (nla_len(la) != sizeof(struct tc_netem_gemodel)) { if (nla_len(la) < sizeof(struct tc_netem_gemodel)) {
pr_info("netem: incorrect gi model size\n"); pr_info("netem: incorrect ge model size\n");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment